• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

matlab help

Gibson486

Lifer
I have an assignment to plot a cirlce in matlab using loops, one using "for", the other using "while".

First, i know i have to use sin. However, i am confused trying to figure out what to use the trig function with. ALso, when making the loop, I know i need to tell matlab to stop at a certain point, therefore, do i need to to assign some sort of threshold? i guess we do this by saying

For x= sin(a)
0<a<pi/2
plot(x)

for x=sin(b)
pi/2<b<pi
plot(x)

for x=sin(c)
pi<c<3*pi/4
plot(x)

for x=sin(d)
3*pi/4<d<2*pi
plot(x)

end

do i atleast have the right idea?

 
You dont need four for statements, and you the condition statement needs to follow the for like
for condition
do this
end

also, for your plot, i think you will need to have two coordinates. You can type "help for" and that should give you some help with the for function.
Hope this helps you get a lilttle farther along.
 
Gibson...
Try posting at the MathWorks sponsored newsgroup
comp.soft-sys.matlab

You'll find lots of helpfull people there... and they use matlab more often than most of the members here!
 
Back
Top