# x or y intercept for 2D data

조회 수: 1 (최근 30일)
University 2024년 2월 9일
편집: University 2024년 2월 11일
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
u_L = uatL.uxl;
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
Unrecognized function or variable 'y'.
##### 댓글 수: 4이전 댓글 2개 표시이전 댓글 2개 숨기기
University 2024년 2월 10일
Sorry that I have to upload the files one by one. I have uploaded the y values one. The data u_L has computed for xi and l values already.
University 2024년 2월 11일
편집: University 2024년 2월 11일
Hi Walter,
%
I want to a contour plot of y-location of intercept point of ( uxr and uxl) as a contour plot as a function of xivlas and Lvals.
I have tried the for one values of xivals and all lvals, which was successful. But I want the intercept for all xivals and all lvals.
for k1 = 1:size(uxl,1)
Ul = uxl(k1,:);
Usignl =sign(Ul);
intsxl = find(diff(Usignl));
for k2 = 1:numel(intsxl)
idxrngl = max(1,intsxl(k2)-1) : min(numel(Ul),intsxl(k2)+1);
yinterceptl(k1,k2) = interp1(Ul(idxrngl), y(idxrngl), 0);
end
end

댓글을 달려면 로그인하십시오.

R2023b

### Community Treasure Hunt

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

Start Hunting!

Translated by