7 questions

Write a script to create the following arrays .
Write a function that takes N as input and finds the account balance after N years. Use for loop.
Repeat (a) without using any loop.
3.For −π/2 ≤ x ≤ π/2, with point spacing Δx = 1/50:
Plot sin(x), cos(x), tan(x), and exp(x) in a single plot. Make sin a red line, cos a black dotted line, tan a blue line, and exp a green dashed line. Make a legend. Label your axes and give th.e figure a title. Set the y axis to be -1<y<1. (20 points)
Extra credit. Write a script that finds the x values at which cos(x)=exp(x). (hint: use find function for |cos(x)-exp(x)|<0.001) (5 points)
4- While. Write a script that takes an integer, N, from the user input. Then computes the largest integer k such that 2k<=N. For example, if N =100, then k would be 6, because 2^6=64 100.
Display/print the message showing the k value: ‘the largest integer k is ….’
Hint: initially, set k=0. In a while loop, check if 2^k is less than N, if not, break the loop. (25 points)
Choose only one question (25 points). You can get extra credit for solving two or three questions:
5. Function, switch statement. Write a function that takes two square matrices of the same size and an operator name as inputs and apply the operator on the two matrices. The operator name can be ‘ ’, ‘-‘, ‘*’, and ‘/’. For example, when the function opName input is ‘ ‘, the function calculates A B; when the function opName input is ‘-‘, the function calculates A-B.
Function C = ApplyOp(A, B, opName)
Switch opName
Case ‘ ’
C=…;

In your main script, create the following matrices and call your function with all operators.
A=421020109,B=340715095
Function. You work for an engineering design firm that has been contracted to evaluate the concentration of pollutants. A tall chimney releases (20 kg/s) of smoke into a steady uniform wind of speed (u( m/s)). An expression for the decay of the peak pollutant concentration C(ppm) with distance downwind is given as:
C(x,y,z)=M4πρDx.e−(y2 z2)u4Dx
Assuming that the diffusion coefficient D to be 0.01 m2/s, and the density of air to be ρ=1.225kgm3
Write a function which gets the location(x,y,z) and the wind speed, u, as inputs and calculates the pollutant concentration.
Call your function to find how pollution concentration at location (x=3000, y=0, z=10) changes with wind speed 0<u<12 m/s. Plot the pollution concentration vs wind speed.
Loops and flow control. Make function called loopTest(N) that loops through the values 1 through N and for each number n it should display ‘n is divisible by 2’, ‘n is divisible by 3’, ‘n is divisible by 2 AND 3’ or ‘n is NOT divisible by 2 or 3’. Use a for loop, the function mod or rem to figure out if a number is divisible by 2 or 3, and num2str to convert each number to a string for displaying. You can use any combination of if, else, and elseif.

This question has been answered by our writers. You can buy the answer below or order your 0% plagiarized answer