Part 1 – Plotting and Varying Parameters

y(x,a) = (xsin(ax −2))/(sqrt(1+(ax)^2))

−π ≤ x ≤π

a = {0.5 1.0 1.5 2.0}

A. Create a function called part1 in a separate m-file that will take a

vector/array input for x (1 by n) and a scalar input for a, and produce the

corresponding output defined by the equation above. The equation must be

vectorized in terms of x. The output from your function is the array y

which should be the same dimensions as the array x.

B. Write a cell mode script that calls the function you created in part 1A, to

compute y(x,a) for the range of x defined above and each value of the

parameter a. You must STORE YOUR RESULTS in some sort of solution

matrix (i.e. set the values of y(x,a), using a different row of the solution

matrix for each value of a).

C. Add another cell to create a plot of the solutions with an appropriate

legend, x and y-axis labels, and figure title.

For part A here is my function:

function [y] = part1(x,a) y=((x*sin(a*x-2))/(sqrt(1+(a*x).^2))); end

For part B this is what I've got so far:

%% clear,clc for x=-pi:pi a=.5:.5:2; part1(x,a) end

I'm stuck here and really don't know how to even begin to progress any further with it. I do know how to do part © with no issues I don't need any help in that area. Any help for part A and B would be greatly appreciated.

Thank you

This post has been edited by **TurboST2**: 04 June 2013 - 04:35 PM