fit shape pf curve through points
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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)
0 comentarios
Respuestas (1)
Saarthak Gupta
el 4 de Dic. de 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)
0 comentarios
Ver también
Categorías
Más información sobre Curve Fitting Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!