How plot Contour in subplot with special function ?

3 views (last 30 days)
i want to plot contour of function involving time when time is change so how i can do this kind of plot of this function?
f=real(0.1003200000e2 ./ (((-0.2373583325e2+0.6098547482e1.*i) + (-0.36e0-0.287e1.*i) .* y + x) .* (-0.750000000e1 - (0.5e1 ./ 0.2e1) .* sqrt(0.1104e2 .* conj((-0.36e0-0.287e1.*i)) + 0.402000e2) + y .* conj((-0.36e0-0.287e1.*i)) + x) + 0.10032e3 ./ ((0.6494333301e1-0.2439418993e1.*i) .* sqrt(0.1104e2 .* conj((-0.36e0-0.287e1.*i)) + 0.402000e2) + (-0.382128e2+0.158424e2.*i) - 0.552e1 .* conj((-0.36e0-0.287e1.*i)))) - 0.5016000000e1 .* ((-0.3123583325e2+0.6098547482e1.*i) - (0.5e1 ./ 0.2e1) .* sqrt(0.1104e2 .* conj((-0.36e0-0.287e1.*i)) + 0.402000e2) + y .* conj((-0.36e0-0.287e1.*i)) + 2 .* x + (-0.36e0-0.287e1.*i) .* y) .^ 2 ./ (((-0.2373583325e2+0.6098547482e1.*i) + (-0.36e0-0.287e1.*i) .* y + x) .* (-0.750000000e1 - (0.5e1 ./ 0.2e1) .* sqrt(0.1104e2 .* conj((-0.36e0-0.287e1.*i)) + 0.402000e2) + y .* conj((-0.36e0-0.287e1.*i)) + x) + 0.10032e3 ./ ((0.6494333301e1-0.2439418993e1.*i) .* sqrt(0.1104e2 .* conj((-0.36e0-0.287e1.*i)) + 0.402000e2) + (-0.382128e2+0.158424e2.*i) - 0.552e1 .* conj((-0.36e0-0.287e1.*i)))) .^ 2)

Answers (1)

Aastha
Aastha on 5 May 2025
Hi @salim,
I understand that you want to create a visualizations that are like the ones shown in the attached images.
To achieve this, you can use the “surfc” and “contour” functions in MATLAB.
The “surfc” function creates a 3D surface plot with a contour plot underneath. It takes three input arguments: “X”, “Y”, and “Z”, where "Z" represents the surface height over the grid defined by “X” and “Y”. This plot corresponds to the (a) part of the attached image.
For more information on “surfc” function, kindly refer to MathWorks documentation:
The “contour” function generates a 2D contour plot showing isolines of the matrix “Z” based on the "X" and "Y" grid. This corresponds to the (b) part of the attached image. You can find the documentation for contour here:
To create a time-varying contour plot, you can use the “subplot” function along with “contour” function. For each subplot, provide data corresponding to a specific time instant.
To annotate the figure with a timestamp, you can use the “text” function in MATLAB. This function allows you to specify coordinates and a text string. You may refer to the MATLAB code snippet below for reference:
text(x, y, 't=50', 'Color', 'red', 'FontSize', 10);
Kindly refer to the MathWorks documentation of “text” function for any queries. Here is the link to it:
I hope this helps!

Categories

Find more on Contour Plots in Help Center and File Exchange

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!