How to display theta properly for Matlab to plot graph?

32 Views Asked by At
y=cos(\theta);
plot(y);
axis([-pi pi -1 1]);

I'm new to Matlab and am trying to display theta, this way doesn't work. How would I display theta in a trig function? I just created a simple version but I will need to apply it to a more complicated version once I understand how to apply it.

1

There are 1 best solutions below

0
On

The plot function accepts two parameters. You can use plot(theta,y) to have the angle on the $x-$axis and the function value on the $y-$axis.