Have a problem about 3D graph

1 view (last 30 days)
Ratchapon Nilprapa
Ratchapon Nilprapa on 27 Sep 2021
I'm new in matlab and I have a problem to plot my 3D graph, please give me for any advise.
Ps. The graph code is below the last 'end'
clear all
clc
% find diffusion coefficients
R=8.314;
T=[600:50:800];
D=0.27*(1.04/-0.22)*exp((-246)./(R*T)); %(unit: cm^2*sec^-1)
% use D to find how far that carbon can diffusion
Cs=[0.15:0.15:0.45];
Cx=0.12;
C0= 0;
%Erf=(Cs-Cx)/(Cs-C0)
Erf=[0.2 0.6 0.7333];
z=NaN(size(Erf));
for n=1:numel(Erf)
if Erf(n)<2
z(n)=(-0.3725*Erf(n)^2)+(1.2144*(Erf(n)))+(0.0006);%and the rest the of the line
else
z(n)=(-0.0109*Erf(n)^2)+(0.0577*(Erf(n)))+(0.9235);%and the rest the of the line
end
end
%find X
X=z(n)*(2*sqrt(D*60));
%Graph 1
T=600:50:800;
X=z(n)*(2*sqrt(D*60));
[T,X]=meshgrid(T,X);
Cs=0.15:0.15:0.45;
mesh(T,X,Cs)
ylabel('diffusion coefficient (cm^2/sec^-1)','fontsize',18);
xlabel('temperature (°C)','fontsize',18);
zlabel('CarbonStart ,fontsize',18);
  2 Comments
KSSV
KSSV on 27 Sep 2021
You cannot plot like that. T, X is 5x5 matrix but Cs is 1x3 array. You need to rethink on what you have to plot.
Ratchapon Nilprapa
Ratchapon Nilprapa on 1 Oct 2021
Thank you to your advise, KSSV.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!