Optimum Cosine Curve fits an irregular curve

4 views (last 30 days)
Asmaa
Asmaa on 26 Sep 2011
I would like to ask about something related to matlab program and I hope you can help.
I drew an irregular curve and I need to fit it with Optimum Cosine Curve, I have searched many in the help files but found nothing!
So I ask for your advice regarding this issue.

Answers (1)

UJJWAL
UJJWAL on 26 Sep 2011
Hi Asmaa,
In MATLAB there is a curve fitting toolbox that can help you this. Following are the steps :-
a) Open the curve Fitting toolbox.
b)click on DATA...
c) Select the variables in the workspace that represtn the x and y-axis data and then click on create new data set.
d) Now Click on Ok and then click on Fitting... which is next to Data...
e) In the Type of Fit combo box select Custom Equations and then click on New.
f)A New window will open and there select the tab corresponding to General Equations.
g) Corresponding to the dependent variable y type the equation like cos(a*x+b).
h) As you will write the constants like a and b they will appear in the table below. You can also modify their starting points and their upper and lower limits. If you have any idea of these quantities depennding upon the nature of your program and your requirements then change them accordingly or let MATLAB handle the issue. It will just take some extra time.
Now CLick ok to go back to the previous window.
i) Click on Apply. MATLAB will compute the appropriate values of the constants and display them in the same wiundow under the title results. It will show the values of the constants you have provided computed in the least squares sense.
There are many other things you can do like setting the confidence interval etc. If you want to know more leave a msg or mail back.
It is also possible to approach things programmatically but it is a bit messy compared to this method. If this suits you then prefer it. I hope this will assist you . Good Luck
Happy to Help
UJJWAL
  4 Comments
Asmaa
Asmaa on 26 Sep 2011
Thanks am really speechless for your great great great help :) Thanks a lot I did it finally, as am a new user of Matlab!
UJJWAL
UJJWAL on 26 Sep 2011
You will learn. No problem. Anytime :)

Sign in to comment.

Categories

Find more on MATLAB 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!