Interpolation using data from excel sheet

3 vues (au cours des 30 derniers jours)
Ranish Sharma
Ranish Sharma le 17 Avr 2024
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!

Réponse acceptée

Mathieu NOE
Mathieu NOE le 17 Avr 2024
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

Plus de réponses (0)

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by