Import data - · PDF fileFunzioni trigonometriche di matlab hanno in input angoli in...
Transcript of Import data - · PDF fileFunzioni trigonometriche di matlab hanno in input angoli in...
Import data
What you can do, how, correct syntax for functions…
Funzioni trigonometriche di matlabhanno in input angoli in radianti.
Conversione gradi-radianti:
xrad=x*2*pi/360xrad2=deg2rad(x)
Matrices and vectors:
Is1: 1x20 vettore rigaMatrice: A=[Is1; Is2; Is3] dimensione 3X20B=[Is1’ Is2’ Is3’] dimensione 20x3
A==B’ apice: trasposizione
IsMEDIA=mean([Is1; Is2; Is3]) 1x20IsMEDIA=mean([Is1' Is2' Is3’]’) 1x20IsMEDIA=mean([Is1' Is2' Is3'],2) 20x1IsMEDIA=mean([Is1' Is2' Is3']) 1x3
Err=(max(A)-min(A))/2
Plotting data
figure(1); scatter(xrad,Is1);hold on;scatter(xrad,Is2);hold on;scatter(xrad,Is3)
figure(1); plot(xrad,IsMEDIA,’o’) errorbar(xrad,IsMEDIA,Err, ’.’)
Fitting data: cftool
FitSave to workspace it creates three objectsfittedmodel =
General model:fittedmodel(x) = a*cos(x-b)^2 +cCoefficients (with 95% confidence bounds):a = 1.012 (0.969, 1.054)b = -0.01514 (-0.03805, 0.007769)c = 0.004618 (-0.02402, 0.03326)
Fittedmodel can be used as a function:
x=linspace(-0.5,3.5,1000)f=fittedmodel(x)Figure(1);hold on;plot(x,f)
figure(1);hold on; fplot(@(x)fittedmodel(x),[-0.8 3.8])
Specific rotation