matlab code 2

matlab code 2 - or disp([vector]) where vector must be...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
b=9; c=a>b; % c = false, numerically = 0 c=a<b; % c = true, numerically = 1 To skip even numbers total3=0; for k=1:19 if fix(k/2)*2~=k total3=total3+k; end end total3 Take two vectors A=[1,2,3,4]; B=[5,6,7,8]; E=a./b- tells it to divide element by element so e=[.2,.33,.4286,.5]; can use with a.*b or a.^b So now we have math operators + - * / ^ .* ./ .^ in general: disp has single argument, ie, disp(argument)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: or disp([vector]) where vector must be either all strings or all numbers vector can NOT be a mix of strings and numbers Plots figure(2) % open new figure window with label = &quot;Figure 2&quot; plot(t,s) % makes plot with t on horizontal, s on vertical grid xlabel('time in seconds','fontsize',14) ylabel('amplitude','fontsize',14) title('plot a sine','fontsize',14)...
View Full Document

Page1 / 2

matlab code 2 - or disp([vector]) where vector must be...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online