Azzera filtri
Azzera filtri

plot data filtering method

2 visualizzazioni (ultimi 30 giorni)
changmin lim
changmin lim il 18 Gen 2024
Commentato: changmin lim il 21 Gen 2024
Hello everyone. Recently I am working on plot data filtering from 2 different plots.
It is hard to explain by text, so I attached an example. This figure attachment shown above is from "Surface scattering impact on Si/TiSi2 contact resistance"(https://doi.org/10.1016/j.sse.2022.108583)
Figure(c) is the results of a graph resulting from the overlay of two plots(figure(a)&(b)), with only the lower values being filtered and displayed.
Like this I wanted to make a graph like figure (c).
Eventhough I tried to find the appropriate function for extracting lower values, it was really hard to find and also hard to apply.
% readfirstfile
file1 = readtable('si_100_5e20_151.xlsx');
x1 = table2array(file1(:, 1));
y1 = table2array(file1(:, 2));
z1 = table2array(file1(:, 3));
kA1 = reshape(x1, 151, 151);
kB1 = reshape(y1, 151, 151);
T1 = reshape(z1, 151, 151);
% read2ndfile
file2 = readtable('nisi2_carti_100.xlsx');
x2 = table2array(file2(:, 1));
y2 = table2array(file2(:, 2));
z2 = table2array(file2(:, 3));
kA2 = reshape(x2, 151, 151);
kB2 = reshape(y2, 151, 151);
T2 = reshape(z2, 151, 151);
% find same value
common_kA = intersect(x1, x2);
common_kB = intersect(y1, y2);
% extract T from overlayered spot
common_T1 = interp2(kA1, kB1, T1, common_kA, common_kB');
common_T2 = interp2(kA2, kB2, T2, common_kA, common_kB');
And than an error occured
Error : interp2>makegriddedinterp
The input grid is not a valid MESHGRID
Error: interp2 (line 134)
F = makegriddedinterp(X, Y, V, method,extrap);
Error: untitled11 (line 26)
common_T1 = interp2(kA1, kB1, T1, common_kA, common_kB')
is there anyway to solve it?
Thank you for reading the questions.

Risposte (1)

Vinayak
Vinayak il 19 Gen 2024
Hi Changmin
Upon analyzing the error you encountered, I noticed that the input grid dimensions didn't conform to the requirements of a valid meshgrid. Identifying the inconsistency in the meshgrid dimensions, I made modifications during the matrix reshaping by transposing the reshaped matrices as it is crucial for a meshgrid to exhibit increasing values. This effectively eliminated the error.
% read first file
file1 = readtable('si_100_5e20_151.xlsx');
x1 = table2array(file1(:, 1));
y1 = table2array(file1(:, 2));
z1 = table2array(file1(:, 3));
kA1 = reshape(x1, 151, 151)';
kB1 = reshape(y1, 151, 151)';
T1 = reshape(z1, 151, 151)';
% read second file
file2 = readtable('nisi2_carti_100.xlsx');
x2 = table2array(file2(:, 1));
y2 = table2array(file2(:, 2));
z2 = table2array(file2(:, 3));
kA2 = reshape(x2, 151, 151)';
kB2 = reshape(y2, 151, 151)';
T2 = reshape(z2, 151, 151)';
% find common values
common_kA = intersect(x1, x2);
common_kB = intersect(y1, y2);
% extract T from overlaid spot
common_T1 = interp2(kA1, kB1, T1, common_kA, common_kB');
common_T2 = interp2(kA2, kB2, T2, common_kA, common_kB');
The above code calculates the interpolation values that can be utilized to plot the coloured heatmaps overlaying on each other. You may refer to the following to learn about "imagesc" and "heatmaps":
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by