Plot contourplot of 2 inputs and 1 output, with one input being varied at z-axis.

1 view (last 30 days)
Hello,
Im currently working making a countourplot where i plot 3 different variables where 2 of them are inputs and one of them are output with values taken from a table which contains different results for a iteration.
Is it possible to making a countourplot in the same style as this picture?
Here the y-values are the output which are being taken from a table for different values on x-axis and the colored lines.
So for example: The purple line I set to a value of 0.7 and for each point on the x-axis I find an output (y) that matches the value 0.7 and the corresponding x-value from my table, this is done in different steps up to the blue line which is a value of 0.4
Is it possible do this on the same way in a conutorplot like this:
Where the y-axis and x-axis stays the same with the difference that the colored lines in the first picture is now the values of the different levels instead? (In a span of 0.4-0.7)?

Answers (1)

sai charan sampara
sai charan sampara on 8 Dec 2023
Hello,
I understand that you are trying to plot the output on y axis and give the second input as levels in a contour plot.
The contour plot function plots a contour plot of the given data. The variables that are plotted on each axis are only determined by the order in which the variables are passed into the contour function call. There is no differentiation of input and output variable. It can be done like the code below.
If X and Y are the input variables and Z is the output variable. Then the normal contour plot is as follows:
[X,Y,Z] = peaks;%random data
contour(X,Y,Z,20)
To get Z on Y axis just rearrange the variables in function call as follows:
contour(X,Z,Y,20)
The “levels” and other properties of the contour plot can be adjusted to get required levels in the contour plot.
You can refer to the below documentation to learn more about contour plot:

Categories

Find more on Contour Plots in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!