2D Contour plot with multiple files

9 views (last 30 days)
Usama Bin Khalid
Usama Bin Khalid on 12 Nov 2022
Edited: Usama Bin Khalid on 15 Nov 2022
hello, i have a list of data files. like 50-60 basically representing CAD. each files consists of columns of different variables. among which one is "x" which represents radius and the other one is mass fraction of "Hiroy SOOT". the latter quantity changes in each file. I want to make a contour plot of Hiroysoot mass. (can be calculated for each col file by multiplying Hiroy soot column with MASS column). X-axis being CAD progression, y-axis being the radius with accumulated hiroy soot plotted as a contour. Basicallly the accumulated soot at each CAD along radius. The files are attached below.
any idea will be appreciated.
  7 Comments
Usama Bin Khalid
Usama Bin Khalid on 12 Nov 2022
Hello DGM yes you are right, it's related to combustion . The picture I attached is as a reference from exp data.. The data now I have is from 3D CFD. Like you said your second point I want the 2D representation of accumulated soot along the radius for each CAD ( for each cad the the data can be summed and saved along the radius ) AND then combine then to make smooth contour which can be called as map not a contour.. I hope this clarifies the problem. I think it can be done with MESHGRID but I lack the excat sequence of how it can be done ....
Usama Bin Khalid
Usama Bin Khalid on 15 Nov 2022
Edited: Usama Bin Khalid on 15 Nov 2022
Hello, i figured out the way how to do it, first i attach the data files on the link
i create the slice for one of the files, by using the script. with this the contour is created as shown below. NOW What i want is to divide this picture into equal circular portions (we can call them rings of width 0.5mm) and then calculate the average of the plotted contour in each ring (by summing the whole mass present in each ring and diving by area of each ring). In this way i will get a vector of averaged values of each ring along the radius.
By doing the same procedure then for other files, we can merge all together and create the plot where we have files names (CAD) along x-axis, radius on y axis and contour in between as per picture i uploaded earlier..
So, i need now help for splitting the image into rings and the calculating the average value of quantity in each ring then plotting it along radius..Finally merging the data of all files to create a 2D map.
%(Radius can be calculated from X and Y given in files). then image should be split in circular portions along radius......
any help will be appreciated. thanks
clear all
cd 'C:\Users\VK\Downloads\output'
data=readtable('tt000045_+3.60647e+02.dat');
data=table2array(data);
datasort=data;
resolution=0.0002;
range=[0 0.00005];
F=scatteredInterpolant(datasort(:,1),datasort(:,2),datasort(:,6),'linear','none');
[X,Y]=meshgrid(min(datasort(:,1)):resolution:max(datasort(:,1)),min(datasort(:,2)):resolution:max(datasort(:,2)));
data2plot=F(X,Y); %this data2plot should be divided into rings in my opinion
imshow(data2plot,range);colormap("hot")
contourf(X,Y,data2plot,5);
xlim([-0.03255 0.03255])
ylim([-0.03255 0.03255])
colormap("jet");
colorbar;
set(gca,'fontweight','bold','fontsize',12)

Sign in to comment.

Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!