Generalized equation using multiple equation

조회 수: 9 (최근 30일)
Raj Arora
Raj Arora 2023년 5월 1일
편집: Matt J 2023년 5월 2일
x = [0.25 0.50 0.75 1 1.25 1.50 1.75 2 2.25 2..50 2.75 3]
y1 = [0.001524 0.00605 0.013592 0.024151 0.037728 0.054321 0.073921 0.096514 0.122102 0.150689 0.182278 0.21687]
y2 = [0.060598 0.14902 0.28793 0.42474 0.57648 0.78663 1.0389 1.6032 2.3667 3.1328 3.8971 4.6297]
y3 = [0.016373 0.0503 0.1896 0.60113 1.2101 1.8134 2.9318 4.0203 4.8728 6.1467 8.1357 10.277]
y4 = [0.11668 0.33853 0.66617 1.2037 1.6292 2.4379 3.6119 4.8274 6.0769 6.4846 8.064 9.6733]
y5 = [0.131518 0.418614 0.793038 1.33235 1.94051 2.54087 4.31947 5.25463 6.33347 7.82779 9.91558 12.4864]
Could someone provide guidance on how to derive a single equation that applies to all five curves, each of which includes a dimensionless parameter "z"? The goal is to have a generalized equation that can be used to obtain the corresponding values for all five cases by simply plugging in different values of "z" (e.g., 0, 0.5, 1, 2, and 2.5).
[Hint: When Z = 0 I will get black curve; When Z = 0.5 I will get blue curve; When Z = 1 I will get red curve; When Z = 2 I will get green curve; When Z = 2.5 I will get magenta curve] (I have also attached an image which also contains separate equations for all five curves in it)

채택된 답변

Matt J
Matt J 2023년 5월 1일
편집: Matt J 2023년 5월 1일
You can use lsqcurvefit with model function,
xdata = [0.25 0.50 0.75 1 1.25 1.50 1.75 2 2.25 2.50 2.75 3];
y1 = [0.001524 0.00605 0.013592 0.024151 0.037728 0.054321 0.073921 0.096514 0.122102 0.150689 0.182278 0.21687];
y2 = [0.060598 0.14902 0.28793 0.42474 0.57648 0.78663 1.0389 1.6032 2.3667 3.1328 3.8971 4.6297];
y3 = [0.016373 0.0503 0.1896 0.60113 1.2101 1.8134 2.9318 4.0203 4.8728 6.1467 8.1357 10.277] ;
y4 = [0.11668 0.33853 0.66617 1.2037 1.6292 2.4379 3.6119 4.8274 6.0769 6.4846 8.064 9.6733] ;
y5 = [0.131518 0.418614 0.793038 1.33235 1.94051 2.54087 4.31947 5.25463 6.33347 7.82779 9.91558 12.4864];
ydata=[y1;y2;y3;y4;y5];
[x,fval]=lsqcurvefit(@F,ones(5,2),xdata,ydata,zeros(5,2))
Local minimum possible. lsqcurvefit stopped because the final change in the sum of squares relative to its initial value is less than the value of the function tolerance.
x = 5×2
0.0126 0.9669 0.1703 1.1217 0.3560 1.1323 0.6457 0.9198 0.6158 1.0116
fval = 8.4752
plot(xdata,ydata','x',xdata,F(x,xdata))
function out=F(x,xdata)
out=x(:,1).*exp( x(:,2).*xdata);
end
  댓글 수: 15
Matt J
Matt J 2023년 5월 2일
편집: Matt J 2023년 5월 2일
I dont have any relation of z with v and x.
If not, your problem is under-specified. There are infinitely many possible surfaces F(v,z) that coincide with your plots at the prescribed z.
Raj Arora
Raj Arora 2023년 5월 2일
Okay Matt J thankyou for your valuable comments. I will try something then I know a way that is multiple non linear regression
I tried it like if T1, T2, T3, T4, T5 are 5 equation for all 5 cases then generalized equation will be
y = c1.T1.(z^1/4)+c2.T2.(z^1/5)+c3.T3.(z^1/6)+c4.T4.(z^1/7)+c5.T5.(z^1/8)
Through this I am getting approriate fit but not the exact result for that I have to put correct value of c1, c2 , c3, c4 and c5

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Matt J
Matt J 2023년 5월 2일
편집: Matt J 2023년 5월 2일
[Hint: When Z = 0 I will get black curve; When Z = 0.5 I will get blue curve; When Z = 1 I will get red curve; When Z = 2 I will get green curve; When Z = 2.5 I will get magenta curve] (I have also attached an image which also contains separate equations for all five curves in it)
Here is one choice which fulfills this, but as I mentioned earlier, it is only one choice of infinitely many:
z=[0,0.5,1,2,2.5];
a=[0.051512, 0.32887, 0.67073, 1.1425, 1.1132];
b=[0.96062, 1.1142,1.1155,0.91651,0.99419];
pa=polyfit(z,a,4);
pb=polyfit(z,b,4);
f=@(z,v) polyval(pa,z).*exp(polyval(pb,z).*v); %joint function of z and v
%Visual check
for z0=[0,0.5,1,2,2.5]
fplot(@(v)f(z0,v)); hold on
end
hold off, xlim([0,3])

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by