fit shape pf curve through points

1 次查看(过去 30 天)
Hello everyone,
I am new to Matlab and I want to keep the shape of the graph that can be seen in the attachment but want to fit it through new specific points. The data that was originally fitted using Fourier in the curve fitting toolbox had a the minimum of around 250 and a maximum of around 460 . For the new data set I only know that the maximum needs to be 2.05x10^4 and minumum 0.8x10^4 . It is important that the shape of the graph remains an ofcourse that the new minimum and maximum are reached. Does anyone have some help on how to do so?
I=imread('curve-input2.jpg')
imshow(I)

回答(1 个)

Saarthak Gupta
Saarthak Gupta 2023-12-4
Hi Lotte,
As per my understanding, it seems you wish to rescale the original function, such that the new range falls between a given maximum and minimum (thereby preserving the ‘shape’ of the originally fitted function).
This can be achieved by a simple mathematical function, which translates and scales the original range. One such (continuous) function can be defined as:
This function maps the original range [min, max] to the new range [a,b]
Refer to the following example for implementing the same in MATLAB:
a_old = -1;
b_old = 1;
a = -0.2;
b = 0.8;
x=linspace(1,10);
y=sin(x);
y_transformed = (b-a)*(y-a_old)/(b_old-a_old) + a;
plot(x,y);
hold on
plot(x,y_transformed);
Plotted ranges (original and transformed)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by