Interpolation using data from excel sheet

조회 수: 3 (최근 30일)
Ranish Sharma
Ranish Sharma 2024년 4월 17일
답변: Mathieu NOE 2024년 4월 17일
I have a excel sheet(attached) which has imformation on the latitude , month and Monthly Average Daily Extraterrestrial Radiation. from this excel sheet i would like matlab to read it and show me option, which is latitude and month and according to the month and latitude chosen the code should use interpolation and give an answer for the Monthly Average Daily Extraterrestrial Radiation.
Help please??
Thanks!

채택된 답변

Mathieu NOE
Mathieu NOE 2024년 4월 17일
hello
I interpreted your request as : pick one month (from 1 to 12) then define whatever latitude query , and do the interpolation
this boils down to make a 1D interpolation on the column that matches which month you're sking for (I didn't expect someone to ask for month = 3. 1548 for example, in my understanding the month "number" is always an integer)
data = readmatrix('rad data.xlsx',"NumHeaderLines",1);
lat = data(:,1); % latitude data
rad_data = data(:,2:end); % radiation data is an array which columns are the 12 months averages
% define which month
month = 3;
rad_data_this_month = rad_data(:,month);
% interpolate this array vs latitude query
lat_query = 86; % must be within -90 / +90 range
rad_data_int = interp1(lat,rad_data_this_month,lat_query)
rad_data_int = 2

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by