MATLAB Answers

3d plot and optimization

20 views (last 30 days)
black_powr
black_powr on 2 Dec 2019
Answered: Alan Weiss on 2 Dec 2019
I am attempting to plot a mesh 3D graph that displays how Cost varies with t, T and P. I then want to solve this graph to find the coordinates that gives the minimum value of Cost. This is the equation relation time, pressure, temperature to cost:
C = (t/60) + (0.18*(T-1073)*(t/3600)) + (1.75*(P/6894.76)*(t/3600));
This is the code I currently have and it doesn't seem to work
T=1073:1:1223;
t=1418.4:86.54:14400;
P=533984.04:4254.16:1172108.74;
[tm,Tm,Pm] = meshgrid(t, T, P);
C = (tm./60) + (0.18.*(Tm-1073).*(tm./3600)) + (1.75.*(Pm./6894.76).*(tm./3600));
figure(1)
mesh(t,T,P,C)
grid on
xlabel('t')
ylabel('T')
zlabel('P')

  1 Comment

darova
darova on 2 Dec 2019
  • I then want to solve this graph to find the coordinates that gives the minimum value of Cost
What about min function?

Sign in to comment.

Answers (1)

Alan Weiss
Alan Weiss on 2 Dec 2019
It is hard to plot a function of three variables. For some approaches, see Plot 3-D Solutions and Their Gradients (this uses PDE Toolbox, but you don't need to have PDE Toolbox to understand or use the plotting ideas).
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

  0 Comments

Sign in to comment.

Sign in to answer this question.