0
votes

I have a function:

a = [-3.14:0.1:3.14]';

function wyn=z(a)
z(a)=L.*sin(a)+ 2*L(cos(a)-cos(a0))*cos(a).*(sin(a)+(sqrt(sin(a).^2+ (H/L)-cos(a)\(cos(a)-cos(a0))))) ;
endfunction

plot(z,a)

where a shold be an angle with a range (-3.14, 3.14). For some reason my plot comes off empty and scilab throws both 1000 and 21 error. Any ideas what should be corrected? Also, how to draw a horizontal line z=2L in this plot?

1

1 Answers

0
votes

Your function isn't defined correctly I think:

function wyn=z(a)
wyn=L.*sin(a)+ 2*L(cos(a)-cos(a0))*cos(a).*(sin(a)+(sqrt(sin(a).^2+ (H/L)-cos(a)\(cos(a)-cos(a0))))) ;
endfunction

You then need to plot as follows:

plot(a,z(a))

To add a horizontal line, you simply need:

plot (a,z(a),a,2*L*ones(size(a))

You haven't defined L or a0 anywhere.