What should be dimension of surf(X,Y,Z) 3D?

14 ビュー (過去 30 日間)
vimal kumar chawda
vimal kumar chawda 2021 年 6 月 11 日
回答済み: Sulaymon Eshkabilov 2021 年 6 月 12 日
I have profile of earth. Surface plot and dimension is not same so How can I plot ?
clc;
close all;
clear all;
format long g;
load('dtm.mat'); %% using old data sets
% plotting the value %%
figure()
title('DTM of the surface of Mountain')
surf(transpose(hw),rw,Z);
xlabel('Longitude')
ylabel('Lateral')
zlabel('Vertical height')
  2 件のコメント
SALAH ALRABEEI
SALAH ALRABEEI 2021 年 6 月 11 日
what is the size of each variable!!
vimal kumar chawda
vimal kumar chawda 2021 年 6 月 11 日
Please check in dtm.mat attachment. Its hw=x=1*451 or rw=y=1*501 and z = 451*501. But my error is dimension should be same in surf. How can I deal with it?

サインインしてコメントする。

回答 (2 件)

Kelly Kearney
Kelly Kearney 2021 年 6 月 11 日
You just need to transpose Z:
surf(hw, rw, Z')

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021 年 6 月 12 日
There are a few errs and missing points in your code. Here is the corrected complete code.
clearvars;
format long g;
load('dtm.mat'); %% using old data sets
% plotting the value %%
[Hw, Rw] = meshgrid(hw, rw); % Meshgrid is required for 3D plots for x, y axes
figure()
title('DTM of the surface of Mountain')
surf(Hw,Rw,Z'); % Transpose of Z is necessary here
xlabel('Longitude')
ylabel('Lateral')
zlabel('Vertical height')

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by