Sinusoidal Regression with given data points

10 views (last 30 days)
Hello, I've been looking around for a few days now regarding a sinusoidal regression of certain data points and I can't seem to wrap my head around it. I found that in a few articles, they say to use the regress() function from the statistics toolbox, which I do have but I am not quite sure how to use it. I have looked at the "help regress" information, but still am having trouble, so here is what I want to do..
I am making a GUI to sample an original wave for experimental purposes. The options for the original wave are frequency, amplitude and phase angle. The option for the sampled wave is sample frequency alone. The way I set it up is you design a wave that is to be sampled and in my programming, I have "t = [0:.002:2*pi]" and "y = a.*sin(w.*t+pa)" and for my sampled data, "t2 = [0:sf/pi:2*pi]" and "y2 = a.*sin(w.*t2)"
Now, for my sampled data, now I have these numbers which I am able to plot and the dots are just connected (interpolation) or I can somehow make a regression of the data to have a sine wave fit to it. If anyone can help me with this then that would be great! Thank you.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!