How to create contour lines?

조회 수: 4 (최근 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