0
votes

I am trying to get solutions of a equation and then plot the result on a graph in MATLAB. Suppose, if a equation is,

R=A*sin(theta)

Where, A is a variable, say from 0 to 5 (which will be plotted on x-axis) and theta is from 0 to 3. The resultant values of R, for continous range of A i.e. 0 to 5, will be plotted on y-axis.

I would like to ask that, in MATLAB, how can I get a continous range of variable A, (and that of theta as well), so that I can plot the values on a graph with respective continous-values (or resultant values) of R?

1

1 Answers

0
votes

you can use ezplot(fun, [xmin xmax]):

theta = pi;
R =@(A) A*sin(theta);
ezplot(R,[0 5]);

EDIT:

In case you want theta range as well you can use the 3D equivalent: ezsurf or fsurf(fun, [xmin xmax ymin ymax]), like that:

R = @(theta,A) A*sin(theta);
ARange = [0 5];
thetaRange = [0 3];
fsurf(R,[thetaRange ARange]);
xlabel('\theta')
ylabel('A')
title('A\cdotsin(\theta)')