How do I fit my data to a cos^2?

4 views (last 30 days)
Agnese Foglietti
Agnese Foglietti on 29 Mar 2019
Answered: Kevin Phung on 29 Mar 2019
Hi, I have collected this data of angle and Intensity to show that Malus law works
theta = [90, 110, 130, 135, 150, 170, 180, 190, 210, 225, 230, 250, 270, 290, 310,315,330, 350, 365, 370, 390]
I= [0.0030, 0.6240, 1.3060, 1.3320, 0.9610, 0.1900, 0.0160, 0.1970, 1.1250, 1.3480, 1.2900, 0.5660, 0.0030, 0.5750, 1.6170, 1.6760, 1.0850, 0.1380, 0.0940, 0.2250, 1.2340]
I tried a few ways but when it comes to plotting I obtain very strange stuff like lines far from the points and I think I just didn't understand how you do this. Thank you very much in advance for your help!

Answers (1)

Kevin Phung
Kevin Phung on 29 Mar 2019
All I used was the plot function and I got something pretty sinusoidal
theta = [90, 110, 130, 135, 150, 170, 180, 190, 210, 225, 230, 250, 270, 290, 310,315,330, 350, 365, 370, 390]
I= [0.0030, 0.6240, 1.3060, 1.3320, 0.9610, 0.1900, 0.0160, 0.1970, 1.1250, 1.3480, 1.2900, 0.5660, 0.0030, 0.5750,...
1.6170, 1.6760, 1.0850, 0.1380, 0.0940, 0.2250, 1.2340]
figure
plot(theta,I)
does this not work for you?

Categories

Find more on Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!