how to plot a multidimensional matrix in matlab

조회 수: 6 (최근 30일)
lamiaa rchida
lamiaa rchida 2022년 12월 12일
답변: C B 2022년 12월 12일
hello, i want to plot a multidimentional matrix in matlab i have
Tempearture : T wich is a 3D array T(: ,: ,k) matrix (p,p,p) size
x and y and z are the temperature position from 0 to p
i really need help

답변 (1개)

C B
C B 2022년 12월 12일
% Create dummy temperature data with size p-by-p-by-p
p = 10;
T = rand(p,p,p);
% Create x, y, and z data for the temperature positions
x = linspace(0,p,p);
y = linspace(0,p,p);
z = linspace(0,p,p);
% Use the meshgrid function to create matrices of x, y, and z data
[X,Y,Z] = meshgrid(x,y,z);
% Use the slice function to plot the temperature data
slice(X,Y,Z,T,[],[],5)
% Add a title and axis labels to the plot
title('Temperature Data')
xlabel('x position')
ylabel('y position')
zlabel('z position')

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by