How to create contour lines?

2 visualizaciones (últimos 30 días)
Behrooz Daneshian
Behrooz Daneshian el 25 de En. de 2023
Respondida: Divyanshu el 21 de Abr. de 2023
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 comentarios
Behrooz Daneshian
Behrooz Daneshian el 25 de En. de 2023
thank you for guidance. I attached a representative subset of the data.

Iniciar sesión para comentar.

Respuestas (1)

Divyanshu el 21 de Abr. de 2023
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:
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}'];
[X,Y] = meshgrid(linspace(0,latitude,10),linspace(0,longitude,10));
Also, you can add x-labels, y-labels, titles and other additional information to the contour. Please refer the following documentations for more information:


Más información sobre Contour Plots en Help Center y File Exchange.


Community Treasure Hunt

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

Start Hunting!

Translated by