how to find y values from smoothing spline curve fit and new x values
2 次查看(过去 30 天)
显示 更早的评论
Hi there
First of all, i'm unsure whether this question is sufficiently different enough to warrant a new post, if not, apologies and can the moderator merge the questions please.
As background for what i am doing and what i am trying;
https://uk.mathworks.com/matlabcentral/answers/385121-finding-average-value-of-multiple-y-values-for-a-single-x-value
Essentially, I have a graph from a suspension dynamometer, plotting absolute velocity against force which forms a hysteresis loop (Force Vs Velocity.jpg), and from this data i am trying to create a single, averaged line (Force Vs Average Velocity.jpg).
The issue i am having is that i dont have nicely spaced x data. What i have is non-monotonic data which has repetitions, so the number -27.6 is repeated 4 times, with four different values associated with it. Plotting Time against velocity, you get the graph shown in Time Vs Velocity.JPG.
I have attempted curve fitting Time Vs Velocity with a smoothing spline, which has given me a 1x1 cfit named fit_V. What i am trying to do with this is input values for V, such as -300:0.01:300, then somehow, using the curve fit, output the corresponding Time values that would be needed to create those evenly spaced Velocity values.
i have tried;
Velocity_data = -300:0.01:300
y_ouput = fit_V(Velocity_data ) % evaluates as though Velocity data is x data, not y data
y_ouput = feval(fit_V, Velocity_data) % answers to the order of 1E+14, not <350 mm/s
y_output = interp1(Velocity, Time, Velocity_Data) %unique points error
So put simply, how can you find the Y data from user defined x data using cfit or any other method.
Thanks Ross
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!