I have a multiple matrice with x,y values with z as dependent variable. How can I average the matrice to make a surface plot?

1 回表示 (過去 30 日間)
Data needs to be extracted from an excel sheet to matlab and each matrix is a different sheet. Here is the example of one such matrix. All the x and y values of these matrix would be almost similar

回答 (1 件)

Kevin Holly
Kevin Holly 2021 年 9 月 15 日
編集済み: Kevin Holly 2021 年 9 月 15 日
Anonyms ,
I would try the following below. Let me know if this is what you wanted.
%Select Excel File to Load
[filename folder] = uigetfile('*.xls*');
%Read sheet 1
sheet = 1;
Data1 = readtable([folder,filename],'Sheet',sheet);
Data1 = table2array(Data1);
%Read sheet 2
sheet = 2;
Data2 = readtable([folder,filename],'Sheet',sheet);
Data2 = table2array(Data2);
%Read x, y, and z
x = Data1(2:end,1);
y = Data1(1,2:end);
z1 = Data1(2:end,2:end);
z2 = Data2(2:end,2:end);
%Calculate Average
zavg = (z1+z2)/2;
%Generate Surf Plot
[xg, yg] = meshgrid(x,y);
surf(xg',yg',zavg)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by