x or y intercept for 2D data
Afficher commentaires plus anciens
I have a 2D data of the form u(y, xi, l). Ie., 31x20x20, where 31 are values of y, 20 are u values that corresponds to 20 xi values and 20 corresponds to 20 l values. How can I find the y intercept of this data? Then plot the contour(xi, l, yintercept)
The code I added is for 1D data. The attached files are 2D data.
clc
uatL = load('u_L.mat');
%xi=load('xivals.mat');
%l= load("lvals.mat");
u_L = uatL.uxl;
y = load('y_vals.mat')
U=u_L(1,:);
for k1 = 1:size(u_L,1)
U = u_L(k1,:);
Usign =sign(U);
intsx = find(diff(Usign));
for k2 = 1:numel(intsx)
idxrng = max(1,intsx(k2)-1) : min(numel(U),intsx(k2)+1);
yintercept(k1,k2) = interp1(U(idxrng), y(idxrng), 0);
end
end
4 commentaires
Matt J
le 10 Fév 2024
As you can see from the output of your code above, y is missing. Also, please do us a favor and put all of your variables in a single .mat file, so that we don't have to download 4 separate files.
Walter Roberson
le 10 Fév 2024
You do not use the xi or l that you load()
University
le 10 Fév 2024
University
le 11 Fév 2024
Modifié(e) : University
le 11 Fév 2024
Réponses (0)
Catégories
En savoir plus sur Contour Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!