How to plot a 3D graph
3 次查看(过去 30 天)
显示 更早的评论
I am attempting to plot a mesh 3D graph that displays how Y_B varies with t and T. I then want to solve this graph to find the coordinates that gives the maximum value of Y_B. This is the code to give a graph that displays how T varies with Y_B for different variables for t
if true
% code
T=600:10:850;
t = 1;
k1 = 10^7.*exp(-12700./T);
k2 = 5*10^4.*exp(-10800./T);
k3 = 7*10^7.*exp(-15000./T);
t=1:2:20;
hold on;
for i=1:numel(t)
Y_B = (k1.*t(i).*(k1+k3))./(((k2.*t(i))+1).*(k1+k3).*(1+(t(i).*(k1+k3))));
plot(T,Y_B);
end
How do I transform this into a 3D plot for t = 0.2:20 and T = 600:850
2 个评论
Star Strider
2018-1-31
What is ‘T’?
What is its range?
How does it enter into the calculation of ‘Y_B’?
采纳的回答
Star Strider
2018-1-31
Use meshgrid to create matrices for ‘t’ and ‘T’, and remove the subscripts from the ‘Y_B’ calculation:
T=600:10:850;
t=1:2:20;
[tm,Tm] = meshgrid(t, T);
k1 = 10^7.*exp(-12700./Tm);
k2 = 5*10^4.*exp(-10800./Tm);
k3 = 7*10^7.*exp(-15000./Tm);
Y_B = (k1.*tm.*(k1+k3))./(((k2.*tm)+1).*(k1+k3).*(1+(tm.*(k1+k3))));
figure(1)
surf(t,T,Y_B)
grid on
xlabel('t')
ylabel('T')
zlabel('Y\_B')
4 个评论
Star Strider
2018-1-31
I would do this:
DisplayCoordinates = [tm(Y_BmaxRow,Y_BmaxCol), Tm(Y_BmaxRow,Y_BmaxCol), Y_B(Y_BmaxRow,Y_BmaxCol)]
DisplayCoordinates =
19.0000 710.0000 0.5114
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!