Data dimensions must agree. Using surf

5 visualizaciones (últimos 30 días)
Olaf Schipper
Olaf Schipper el 9 de Ag. de 2022
Comentada: Olaf Schipper el 9 de Ag. de 2022
I want to make a 3D plot using MATLAB with the code below:
[pA, T] = meshgrid(7600000:100000:20000000, 313:1:373);
mu = ((((-0.1146067)+(0.000000697838).*(pA/100000)+(0.0000000003976765).*((pA/100000).^2)+(0.0633612).*log(T)+(-0.01166119).*(log(T).^2)+(0.0007142596).*(log(T).^3))/(1+(0.000006519333).*(pA/100000)+(-0.3567559).*log(T)+(0.03180473).*(log(T).^2)))/1000);
surf(pA, T, mu);
colormap(jet); % change color map
shading flat % interpolate colors across lines and faces
colorbar;
pA and T are 61x125 matrices and mu is 61x61. Is there a possibility to equalize this so that I can make the surface plot? Or is there another way to make a 3D plot with these matrices?

Respuesta aceptada

Walter Roberson
Walter Roberson el 9 de Ag. de 2022
[pA, T] = meshgrid(7600000:100000:20000000, 313:1:373);
mu = ((((-0.1146067)+(0.000000697838).*(pA/100000)+(0.0000000003976765).*((pA/100000).^2)+(0.0633612).*log(T)+(-0.01166119).*(log(T).^2)+(0.0007142596).*(log(T).^3)) ./ (1+(0.000006519333).*(pA/100000)+(-0.3567559).*log(T)+(0.03180473).*(log(T).^2)))/1000);
surf(pA, T, mu);
colormap(jet); % change color map
shading flat % interpolate colors across lines and faces
colorbar;
You accidentally used / where you needed ./
  1 comentario
Olaf Schipper
Olaf Schipper el 9 de Ag. de 2022
That was indeed the problem. Thank you very much!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by