1. 程式人生 > >matlab畫三維圖

matlab畫三維圖

從excell中讀取資料,並繪出三維圖

clear all;
clc;
X_t= 1:1:12;
Y = xlsread('22.xlsx','sheet1','A4:A1266');
Y_wavelenth = Y';
M = xlsread('22.xlsx','sheet1','B4:M1266');
M33 = M';
 for i= 1:12
     X = X_t(i)*ones(size(Y_wavelenth));
     plot3(X,Y_wavelenth,M33(i,:),'r.--');
     hold on;
 end
 xlabel('時間t'
),ylabel('波長'),zlabel('M33') grid on;