How to convert this fplot to 3D plot view
4 ビュー (過去 30 日間)
古いコメントを表示
syms z
t=0.2;
sc=0.6;
s1=z;
s2=2*(sqrt(t));
x=(s1./s2);
c5=exp((2*x*(sqrt(sc*t))));
c6=erfc((x*sqrt(sc))+(sqrt(t)));
c7=exp((-2*x*(sqrt(t*sc))));
c8=erfc((x*sqrt(sc))-(sqrt(t)));
q=((1/2)*((c5*c6)+(c7*c8)));
xlim([0 5]);
ylim([0 1]);
fplot(z,q)
hold on
legend ("sc=2.01","sc=","sc=0.6");
xlabel("η (Similarity parameter)");
ylabel("C (Concentration)");
0 件のコメント
採用された回答
その他の回答 (1 件)
Shishir Reddy
2024 年 8 月 6 日
Hi Dilip
To convert a 2D plot to a 3D mesh, a third variable needs to be introduced. In this case, the variable sc can be considered as third dimension and the mesh plot can be generated for function q against z and sc.
This can be implemented in MATLAB as follows
% Define symbolic variables
syms z sc
t = 0.2;
% Intermediate calculations
s1 = z;
s2 = 2 * (sqrt(t));
x = (s1 ./ s2);
c5 = exp((2 * x * (sqrt(sc * t))));
c6 = erfc((x * sqrt(sc)) + (sqrt(t)));
c7 = exp((-2 * x * (sqrt(t * sc))));
c8 = erfc((x * sqrt(sc)) - (sqrt(t)));
q = ((1 / 2) * ((c5 * c6) + (c7 * c8)));
% Define the range for z and sc
z_range = [0 5];
sc_range = [0.5 2.5]; %these values can be changed as per requirement
% Plot the 3D surface using fsurf with symbolic expression
fsurf(q, [z_range sc_range])
xlabel('z (Similarity parameter)')
ylabel('sc')
zlabel('C (Concentration)')
title('3D Surface Plot of Concentration vs Similarity Parameter and sc')
For more information regarding the ‘fmesh’ function, kindly refer the following documentation https://www.mathworks.com/help/matlab/ref/fmesh.html
I hope this helps.
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!