How to create contour lines?

3 次查看(过去 30 天)
Behrooz Daneshian
Behrooz Daneshian 2023-1-25
回答: Divyanshu 2023-4-21
Hi all,
I have created a cell array called “stationsID” containing information about existing weather stations located in the state of Alaska. Column 5, 6, and 7 of the “stationID” represent elevation, latitude, and longitude of each weather station respectively. (please note that the number of rows of “stationID” is equal to the number of weather stations in that state). I have another cell array called "stations2" in which specific parameters for first weather station located in stationsID{1,1} for each year is estimated. stations2{:,16 to 20} represent probability of frost depth exceedance of 1 feet, 2 feet, 3 feet, 4 feet, and 5 feet respectively. You might ask why the dimension of these probabilities is 1*10. It is because they are calculated for 10 different combinations of two other parameters.
What I intend to do is to draw contour lines showing probability of frost depth exceedance (for example let say of 1 feet) for each year, for each weather station, and for each of 10 combinations. Can anyone help me with this regard?
  2 个评论
dpb
dpb 2023-1-25
Either attach a representative subset of the data or, you can try zipping it if it's the text file of data you're talking of and not the actual .mat file itself...
Behrooz Daneshian
Behrooz Daneshian 2023-1-25
thank you for guidance. I attached a representative subset of the data.

请先登录,再进行评论。

回答(1 个)

Divyanshu
Divyanshu 2023-4-21
As per the description provided, ‘stations2.matin this file rows represent 10 years and for each row, columns 16 to 20 holds an array of 10 probabilities. These are probabilities of frost exceedance for 10 different combinations of certain parameters, for station 1.
Based on the above understanding here is a sample script to draw contours for probabilities of frost depth exceedance of 2 feet:
load('stationsID.mat');
load('stations2.mat');
latitude = stations3{1,6};
longitude = stations3{1,7};
%this loop iterates over all the years for station 1
probs = [];
for i=1:10
probs = [probs stations2{i,17}'];
end
[X,Y] = meshgrid(linspace(0,latitude,10),linspace(0,longitude,10));
contour(X,Y,probs);
colorbar;
Also, you can add x-labels, y-labels, titles and other additional information to the contour. Please refer the following documentations for more information:

类别

Help CenterFile Exchange 中查找有关 Contour Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by