MATLAB: Help with Alogrithm???

codeellipsegraphradians

im trying to do linear interpolation the parametric equations for the ellipse i have are
x=30*cos(t)
y=15*sin(t)
when i simply put it and plot it the graph is fine but when i try something like this
s=pi/180; %to make radians.
>> for i=1:360; %for every degree
t=s*i; %degree in to radians
x=30*cos(t);
y=15*sin(t);
end
>> plot(x,y)
please help Im new with this coding

Best Answer

You could save the x and y result from each iteration in a vector, but rather that do that you don't really need the for loop at all. E.g.,
s=pi/180; %to make radians.
i=1:360; %for every degree
t=s*i; %degree in to radians
x=30*cos(t);
y=15*sin(t);
plot(x,y)