fit shape pf curve through points

조회 수: 1 (최근 30일)
Lotte Piek
Lotte Piek 2022년 4월 14일
답변: Saarthak Gupta 2023년 12월 4일
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에서 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