Interpolate multiple data for a plot
Show older comments
I am having trouble interpolating data. I don't quite know what variables to insert into interp1. I need to plot sea against temperature after interpolating as the time for sea and time for weather is different. Any tips?
for k=1:7
figure
w{k} = interp1(timeweather{k},avgtemp{k},sealevel{k},'linear');
plot(timeweather{k},avgtemp{k},'-',5,w{k},'*')
plot(timeweather{k},avgtemp{k},'r')
hold on
plot(timesea{k},sealevel{k},'c')
end
3 Comments
Tip: use a timetable and synchronize.
Can you tell us what the 7 cells of the cell array describe? Are they different locations or something? Also, what format is the time in, is it in fractional years?
num2str(timesea{1})
ans =
912×9 char array
'1935.0416'
' 1935.125'
'1935.2084'
Madlab
on 17 Oct 2018
Madlab
on 17 Oct 2018
Accepted Answer
More Answers (0)
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!