Comparing multiple curves to an optimal curve

I am collecting twice a total of 240 Trials of 4 secs each. Subjects are required to apply a certain amount of force (depending on the day's max force) at the time point 3secs with their thumb. This results in a 240 different curves per day. I manage to compute the graphs for the 240 trials. My Question now is: How can I fit an additional curve to the 240 curves which depicts the perfect curve, usinf on only a handfull of data-points based on the day's max force(the program I am using currently collects 4000 data points during the 4 secs, which is way to much to write down by hand)? Furthermore how do I calculate the average difference between each trial and the optimal curve? So far I am only using plot() to generate the graphs.
Thank you very much

Answers (1)

Depends on how you define your "perfect curve" there should be some criterion. Do you want to average it? If you want to fit the average curve, then depending on the curve choose an equation or model that best describes your curve and fit it using curve fitting or optimization.
Once you have your "optimal curve" you can always find a sum or squares error or MSE

7 Comments

How can I upload an image of a typical output I get? It would make it a lot easier to explain...
I am not sure, you may have to upload it else where and link it to this post.
subjects in my experiments are asked to get the curve to peak as close to the intersection between the middle horizontal line at y=1.25 and the vertical line at x=4000 (as you can see the subject did not very good). The optimal curve would stay at y=0 until around x=3000/3500, then have a steep incline to y=1.25, x=4000 and then drop of again to y=0. I would then like to calculate how much the subject's curve differ from that optimal curve.
How can I fit in the optimal curve based on maybe 10-20 datapoints , so that matlab can fill in the rest and how would I then compare it to the other curves.
Thanks
That should be easy enough, you can choose a polynomial or another model to fit your optimal curve. There are several ways to do that. If you have curve fitting toolbox that would be easiest. If you don't then you will have to set up an optimization problem to fit that curve. You can also find the mean square error between the optimial curve and your other curve to quantify how "off" they are. If it is just 10-20 points can you please share it here so I can show you an example?
I don't think I have the curve fitting toolbox. Where could I check that? In the example figure I posted above the points the ideal curve would pass through would be: [0 0; 1000 0; 2000 0; 3000 0; 3500 0.625; 4000 1.25; 4500 0.625; 5000 0; 6000 0; 7000 0; 8000 0].
Thanks for your help so far
Are you sure? that data looks nothing like the curve in your picture.
In anycase you can fit the curve using curve fitting toolbox, and the way to check is to try the following command in MATLAB.
>> cftool
It is intuitive enough that you can get to work immediately. If you don't then you will have to set up an optimization problem to do the same. You can start here:
I realised that I typed the data in completely wrong.
I added the following plot to the curves x= [0; 1000;2000;3000;3500;4000;4500;5000;6000;7000;8000] y=[0;0;0;0;0.625;1.25;0.625;0;0;0;0] plot(x,y, 'k', 'linewidth',3)
I would like it to look a bit more curve shaped without adding much more data points, as for each subjects I would have to type it in by hand. I would then like to calculate the difference between the black line and all the other curves.

Sign in to comment.

Categories

Tags

Asked:

Ben
on 31 Jan 2013

Community Treasure Hunt

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

Start Hunting!