Plotting lists in matlab

170 Views Asked by At

I'm working on a matlab project:

enter image description here

We just started matlab, we haven't had any tutorials, just projects. We were giving a handout for it but it doesn't help. I'm really confused about this

1

There are 1 best solutions below

3
On BEST ANSWER
function drawpattern(theta,n)
d = theta*pi/180; %convert to radians
R=[cos(d) sin(d); -sin(d) cos(d)];
p_last=[0;0];
x=zeros(1,n+1);
y=x;
figure;
hold on;
for i=1:n+1
    x(i)=p_last(1);
    y(i)=p_last(2);
    p_last=p_last+R^(i-1)*[i;0];
end
plot(x,y)
axis('equal')
box on

enter image description here

enter image description here

enter image description here