Generalized equation using multiple equation
1 次查看(过去 30 天)
显示 更早的评论
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)
0 个评论
采纳的回答
Matt J
2023-5-1
编辑:Matt J
2023-5-1
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))
plot(xdata,ydata','x',xdata,F(x,xdata))
function out=F(x,xdata)
out=x(:,1).*exp( x(:,2).*xdata);
end
15 个评论
更多回答(1 个)
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])
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fit Postprocessing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!