필터 지우기
필터 지우기

How can I produce new coordinates for one dimension if a matrix and interpolate to these new coordinates?

조회 수: 9 (최근 30일)
Hello,
I have a 1824x6 matrix and I want to produce new coordinates for the row dimension, which stands for the depth, in order to get a smoother contour plot. I don't want to change the column dimension, because it stands for the times when the measurements where taken.
I used meshgrid to produce new coordinates:
newpoints = 100;
[xq,yq] = meshgrid(...
linspace(min(min(depthFehmarn,[],1)),max(max(depthFehmarn,[],1)),newpoints )...
);
Now I wanted to interpolated with following code:
FehmarnWT_interpl = interp2(depthFehmarn,dateFehmarn,FehmarnWT_no10,xq,dateFehmarn,'linear');
I get this error message: Query coordinates input arrays must have the same size.
But I don't want new coordinates for the column dimension and now I don't know how to solve this dilemma.
I use R2020b.
Thanks in advance for your help. :)

채택된 답변

Matt J
Matt J 2021년 12월 1일
편집: Matt J 2021년 12월 1일
INTERP1 would be sufficient here.
depthFehmarn=unique(depthFehmarn);
xq=linspace( depthFehmarn(1) , depthFehmarn(end) , newpoints);
FehmarnWT_interpl = interp1(depthFehmarn, FehmarnWT_no10, xq);

추가 답변 (1개)

Matt J
Matt J 2021년 12월 1일
편집: Matt J 2021년 12월 1일
depthFehmarn=unique(depthFehmarn);
xq=linspace( depthFehmarn(1) , depthFehmarn(end) , newpoints);
F=griddedInterpolant({depthFehmarn,1:6},FehmarnWT_no10);
FehmarnWT_interpl = F({xq,1:6});

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by