필터 지우기
필터 지우기

how to plot a 3d surface with a matrix

조회 수: 20 (최근 30일)
Joseph Lee
Joseph Lee 2017년 11월 2일
편집: KL 2017년 11월 2일
M=201x201 matrix of 400201 numbers, each number is a height
how to plot against x and z from x=10 to 30 with 0.1 increment and z from z=1 to 3 with 0.01 increment
3 Axis: x,z,height
M(1,1) will be plotted on x=10 and z= 1
M(1,2)will be plotted on x=10 and z= 1.001
M(1,2)will be plotted on x=10 and z= 1.002
M(2,1) will be plotted on x=10.1 and z= 1

채택된 답변

Star Strider
Star Strider 2017년 11월 2일
Try this:
v = linspace(-2*pi, 2*pi, 201); % Create Data
[X,Y] = meshgrid(v); % Create Data
M = sin(X) + cos(Y); % Create Data
x = 10:0.1:30;
z = 1:0.01:3;
figure(1)
mesh(x, z, M)
grid on

추가 답변 (1개)

KL
KL 2017년 11월 2일
편집: KL 2017년 11월 2일
Something like this?
x = 10:0.1:30;
z = 1:0.01:3;
[X,Z] = ndgrid(x,z);
mesh(X,Z,M)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by