Help with the surf function
3 ビュー (過去 30 日間)
古いコメントを表示
I am trying to create a surface plot of a matrix I created, but I need to make lattitude and longitue in to 180x360 matrices as well in order for the function to work. My code is below:
%Plot Slopematrix
addpath('C:\Users\Falon Treis\Documents\MATLAB\CE1_2C_slopematrix.mat');
%addpath('C:\Users\Falon Treis\Documents\MATLAB\CE2_2C_slopematrix.mat');
load('CE1_2C_slopematrix.mat')
k = 1:180; %lat make have 180x 360 matrix
m = 1:360; %long
z = slopematrix; %180x360
surf(k, m, z)
%surf(k, m, z)
save CE1_2C_slope_plot.mat
%save CE2_2C_slope_plot.mat
0 件のコメント
回答 (1 件)
Walter Roberson
2021 年 4 月 28 日
surf(k, m, z.')
Remember that the rows correspond to y not to x
5 件のコメント
Walter Roberson
2021 年 4 月 28 日
lat is vertical, not horizontal, so you should not be using it as your x.
k = 1:180; %lat make have 180x 360 matrix
m = 1:360; %long
slopematrix = sort(rand(length(k), length(m)));
size(slopematrix)
z = slopematrix;
surf(m, k, z)
xlabel('long')
ylabel('lat')
zlabel('slope')
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

