Docsity

Programming with matlab, coding, Lab Reports of Programming Languages

Partial preview of the text

Download Programming with matlab, coding and more Lab Reports Programming Languages in PDF only on Docsity!

Carlyn Annunziata MENG 201 Lab 5 Professor Liu

  1. function [v,y,z,w]= statis(x); v=mean(x); y = std(x); z = min(x); w = max(x); command window: x = [10 20 30 40 50]; [a b c d]=statis(x) a = 30 b =

c = 10 d = 50

2) F = 60:2:70;

>> F_C = @(F) (F-32).*5/9;

F_C(F)

ans = 15.5556 16.6667 17.7778 18.8889 20.0000 21. Alternative; Using M-file: Script window: function [C]=F_C(F) C = (F-32).*5/9; Command window: F =60:2: F = 60 62 64 66 68 70

F_C(F) ans = 15.5556 16.6667 17.7778 18.8889 20.0000 21.

  1. poly_plot = @(x) x.^2+2*x-exp(x);

fplot(poly_plot,[-2,2])