How to make Linear Interpolation

조회 수: 14 (최근 30일)
Flashbond
Flashbond 2013년 8월 23일
I have a room 12x12m². I placed data loggers in every 3 meters in order to measure temperature. Here the matrix I prepared:
How can I fill the zero values with linear interpolation to simulate room's representational view in surf plot?

채택된 답변

Shashank Prasanna
Shashank Prasanna 2013년 8월 23일
I am assuming you are using a version of MATLAB atleast after R2012a. If not you can repeat the similar exercize using meshgrid and interp2.
% Actual Data
Z = [24.6,24.4,24;24.7,24.3,24;24.6,24.1,23.9]
[X,Y] = ndgrid([3,6,9],[3,6,9]);
% Interpolation
F = griddedInterpolant(X,Y,Z,'linear');
[Xnew,Ynew] = ndgrid(1:11,1:11);
Znew = F(Xnew,Ynew)
surf(Xnew,Ynew,Znew)
  댓글 수: 1
Flashbond
Flashbond 2013년 8월 23일
편집: Flashbond 2013년 8월 23일
Thanks! One more thing; Also I have a Z2 humidity.
Zh = [40.8,41.1,41.4;40.7,41,41.6;40.7,41.1,41.3]
Is it possible to make humidity is the height of suface plot and temperature are the colors? Or Should it be another question in the forum?

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

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by