how to use mesh to plot 3D image?
Show older comments
I couldnt get mesh instead of plot3. help anyone.
clc
clear all
u1=4;u2=8;a=30;b=5;a2=100;A=500;c2=10;c3=12;c4=8;D0=115; b2=0.2;
a=0.01;d=0.2;m=0.5;k1=0.5;k0=1;k2=2;
c1=5;
t1= 0.2 : 0.2 :1.8
T=0.2 : 0.2 :1.8
n=length(t1)
j=1;
for i=1:n
TC=(1./T(i)).*(c1.*((b-a)-b.*t1(i)-(a+b.*(1+m)./(1+m-t1(i))))+c2.*(b.*t1(i)-(a+b.*(1+m)).*(t1(i)./(1+m-t1(i))))+c3.*((a./k1)-((b./k1.^2).*(1-k1.*T(i))).*(((-u1.*k1)./(1+k1.*(t1(i)-T(i)))+1)-((1-k1.*T(i))./(1+k1.*(t1(i)-T(i))))+(b.*k0.*(t1(i)-u1)./k1)-(a-(b.*k0.*(1-k1.*T(i))./k1)).*((u2-u1)./(1+k1.*(t1(i)-T(i))))+(k0.*D0./k1).*((k1.*(u1-u2)./(1+k1.*(t1(i)-T(i))))-(a-(b.*k0./k1).*(1-k1.*T(i))).*((T(i)-k2)./(1+k1.*(t1(i)-T(i))))+(b.*k0./k1).*(u2-T(i))-(1-k1.*T(i)).*((T(i)+u2)./(1+k1.*(t1(i)-T(i))))+c4.*(-a2+b2.*t1(i)+k0.*(a-(b./k1).*(1-k1.*T(i)).*(1./(1+k1.*(t1(i)-T(i)))+(b./k1))))))));
%TC=(a/T(i))*((A/a)+(h/(th+b))*(((th+b)*(exp(-R*td)-1)/(b*R))+(1/(b+R))*(exp(b*td)-exp(-R*td))*(exp((th+b)*(t1(i)-td))+(th/b)))+((h)/(th+b))*((1/R)*(exp(-R*t1(i))-exp(-R*td))+(1/(th+b+R))*(exp((th+b)*(t1(i)-td)-(R*td))-exp(-R*t1(i))))+((s*del)/(R^2))*(exp(-R*t1(i))-exp(-R*T(i))*(R*(T(i)-t1(i))+1))+(pi*(1-del)/R)*(exp(-R*t1(i))-exp(-R*T(i)))+p*((1/(th+b))*(exp((th+b)*(t1(i)-td))-1)*exp(b*td)+(1/b)*(exp(b*td)-1)+del*exp(-R*T(i))*(T(i)-t1(i))));
z(j)=TC;
j=j+1;
end
% t1,
%
% T
% z
length(T);
length(z);
mesh(t1,T,z(t1,T))
axis square; grid on
% (a/x(1))*(exp(-R*x(1))*s*del*(x(1)-x(2))+exp(-R*x(1))*pi*(1-del)+p*del*exp(-R*x(1))*(1-R*(x(1)-x(2))))-(a/(x(1)^2))*((A/a)+(h/(th+b))*(((th+b)*(exp(-R*td)-1)/(b*R))+(1/(b+R))*(exp(b*td)-exp(-R*td))*(exp((th+b)*(x(2)-td))+(th/b)))+((h)/(th+b))*((1/R)*(exp(-R*x(2))-exp(-R*td))+(1/(th+b+R))*(exp((th+b)*(x(2)-td)-(R*td))-exp(-R*x(2))))+((s*del)/(R^2))*(exp(-R*x(2))-exp(-R*x(1))*(R*(x(1)-x(2))+1))+(pi*(1-del)/R)*(exp(-R*x(2))-exp(-R*x(1)))+p*((1/(th+b))*(exp((th+b)*(x(2)-td))-1)*exp(b*td)+(1/b)*(exp(b*td)-1)+del*exp(-R*x(1))*(x(1)-x(2))))
Index in position 1 is invalid. Array indices must be positive integers or logical values.
mesh(t1,T,z(t1,T))
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!