creating 3d surface plots by iterating in for loop through different vectors

11 visualizaciones (últimos 30 días)
Gova
Gova el 10 de Mayo de 2023
Comentada: Gova el 16 de Mayo de 2023
I am working on creating a 3d plot. I have these variables as matrices but I need to generate a 3d matrix with for loop iteratively and plot as seen in the below code.
In this code the plot is like a seperate vector output because it won't generate a surface, but scattered points. I would like an 3d surface plot by generating a 3d matrix with for loop iteratively. Please help me out on this!
x = Oil_Flow_Rate; % create a matrix of complex inputs
y = Oil_Temp;
z = Water_Temp;
w = TMax; % calculate the complex outputs
scatter3(x,y,z,40,w,'filled') % visualize the complex function using surf
ax = gca;
ax.XDir = 'reverse';
view(-31,14)
xlabel('Oil FlowRate [L/min]','FontWeight','Bold','FontSize',sizeW)
ylabel('Oil Temp [°C]','FontWeight','Bold','FontSize',sizeW)
zlabel('Water Temp [°C]','FontWeight','Bold','FontSize',sizeW)
cb = colorbar; % create and label the colorbar
cb.Label.String = 'TMax [°C]';

Respuestas (1)

Walter Roberson
Walter Roberson el 10 de Mayo de 2023
In a situation like that, I would not recommend creating the entries iteratively in a loop. Instead I would suggest creating a grid of locations you want the values to be evaluated at, and use either griddata or scatteredInterpolant
  1 comentario
Gova
Gova el 16 de Mayo de 2023
Thanks for the response @Walter Roberson, can you say how the code is to be modified in my case. I am a beginner in Matlab please bear with me

Iniciar sesión para comentar.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by