Plotting a 3D contour graph

1 visualización (últimos 30 días)
Ashwinraj Gnanavel
Ashwinraj Gnanavel el 30 de Oct. de 2019
Comentada: Ashwinraj Gnanavel el 6 de Nov. de 2019
I wanted to plot a 3D graph with 'x' as height, 'y' as radial distance, 'z' as soot volume fraction. I have calculated the soot volume fraction using the matlab already and they are displayed as a matrix in the table I have attached below (I have attached in both .matlab and excel format). It is a 11 X 256 matrix, where each row number (1 to 11) corresponds to a height and column number (1 to 256) (A to IV) corresponds to a radial distance. For example for a height of 10mm (row no. 11) and radial distance 0.1 mm (column number 8 (H) , the soot volume fraction is 0.102915.
Along the x-axis: height should increase by 10mm from 0mm to 60mm
Along the y-axis: radial distance should increase by 0.1 mm from 0mm to 3.3mm (i.e, from column number 0 to column number 256).
0mm height corresponds to row number 12
10mm height corresponds to row number 11
20mm height corresponds to row number 10
30mm height corresponds to row number 8
40mm height corresponds to row number 6
50mm height corresponds to row number 4
60mm height corresponds to row number 2
Initially,the soot volume fraction values are plotted for 0mm height for radial distance from 0mm to 3.3mm increasing by 0.1mm ,then for height 10mm for radial distance from 0mm to 3.3mm increasing by 0.1mm and so on till the height of 60mm. I have also attached the simple table.
Now, along different columns (along radial distance), 0.1 mm increase means it increases by 8 columns. I dont want the soot volume fraction values for all the radial distances, I just want soot vol. fraction values for every 8 columns (every 0.1 mm) of a particular row. For example, if the value is plotted for 20mm height (row 10) ,first 0mm radial distance (coloumn 0) where the soot volume fraction is 0 , then 0.2 mm (column 8), then 0.3 mm (column 16) and so on till 3.3mm (column 256). Same pattern for all the heights 0,10,20,30,40,50,60 mm.
For 0mm height at any radial distance,the soot volume fraction is zero.
Importantly, the heights should be labelled as 0mm , 10mm , 20mm,....,60mm instead of the row number along x-axis.
THEREFORE, someone please give a code to get the above 3D contour plot(graph) with the above inputs and as i said i have attached the soot volume fraction values in the table below.
I think you might have to use 'for' loops and linspace function and all to read values every 8 columns once for a particular height but I could not develop the exact code to get a 3D plot of the above requirements. So someone kindly help me by giving the exact code.
  5 comentarios
Ashwinraj Gnanavel
Ashwinraj Gnanavel el 1 de Nov. de 2019
okay ,grid data would be good then :)
Ashwinraj Gnanavel
Ashwinraj Gnanavel el 2 de Nov. de 2019
Hi, were u able to get the code,sir?

Iniciar sesión para comentar.

Respuesta aceptada

darova
darova el 2 de Nov. de 2019
Example with interp2
load matlab.mat
Z = fv_avg_condensed;
[m,n] = size(Z);
[X,Y] = meshgrid(1:n,1:m);
[Xq,Yq] = meshgrid(1:8:n, 1:m); % each 8th column
Zq = interp2(X,Y,Z,Xq,Yq);
contour(Zq)
  1 comentario
Ashwinraj Gnanavel
Ashwinraj Gnanavel el 6 de Nov. de 2019
Thank you sir , it really worked :)

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by