How to convert this fplot to 3D plot view

조회 수: 3 (최근 30일)
Dilip Jose
Dilip Jose 2024년 8월 6일
댓글: Dilip Jose 2024년 8월 7일
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");
Warning: Ignoring extra legend entries.
xlabel("η (Similarity parameter)");
ylabel("C (Concentration)");

채택된 답변

Matt J
Matt J 2024년 8월 6일
view(3)
Warning: Ignoring extra legend entries.
  댓글 수: 2
Dilip Jose
Dilip Jose 2024년 8월 6일
편집: Dilip Jose 2024년 8월 6일
tan q.....is there any possible to view like mesh ?
Dilip Jose
Dilip Jose 2024년 8월 6일

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

추가 답변 (1개)

Shishir Reddy
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 CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by