matlab code 2

# matlab code 2 - or disp[vector where vector must be either...

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

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)

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

View Full Document
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 = "Figure 2" 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

{[ snackBarMessage ]}

### Page1 / 2

matlab code 2 - or disp[vector where vector must be either...

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

View Full Document
Ask a homework question - tutors are online