fit shape pf curve through points

1 visualizzazione (ultimi 30 giorni)
Lotte Piek
Lotte Piek il 14 Apr 2022
Risposto: Saarthak Gupta il 4 Dic 2023
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)

Risposte (1)

Saarthak Gupta
Saarthak Gupta il 4 Dic 2023
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)

Categorie

Scopri di più su Curve Fitting Toolbox in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by