필터 지우기
필터 지우기

How to use interp1 with different length?

조회 수: 3 (최근 30일)
john john
john john 2012년 1월 10일
How to use interp1 with different length?

채택된 답변

Walter Roberson
Walter Roberson 2012년 1월 10일
The idea of using interp1 is obviously slowing you down, so use a different method.
MappedX = ((X - OldRangeMin) / (OldRangeMax - OldRangeMin) * (NewRangeMax - NewRangeMin) + NewrangeMin;
But to answer your question: you do not use different X and Y lengths: you use the same lengths, even if they represent different interval widths.
MappedX = interp1([OldRangeMin OldRangeMax], [NewRangeMin NewRangeMax], X);
  댓글 수: 2
john john
john john 2012년 1월 10일
great.. this is my problem now...my problem now....code below is for solving EL, which is he will read excel(contains the table) if the result same on the table he will give equivalent row value, if not he will interpolate the excel...so my problem how do i interpolate the table on excel...
a = get(handles.input1_gamma,'String'); %GAMMA
b = get(handles.input2_h,'String'); %H
c = get(handles.input3_q,'String'); %Q
d = get(handles.input4_power,'String'); %POWER
e = get(handles.input5_eout,'String');
out = str2num(b) + str2num(e);
set(handles.total_answer,'String',out);
data = xlsread('table.xlsx')
[m n] = size(data)
k = get(handles.total_answer,'String')
for i = 1 : m
A = data(i); %check xa 1st row then compare value
A = int2str(A);
if strcmp(A,k)
n = i;
score = data(n,2)%compare sa 2nd value
clc; %clear and cmd
set(handles.equalel,'String',score);
break;
else strcmp(A,k)
n = i;
score = data(n,2)
mHeight = (A)
mEout = (score);
outputArea = interp1(mHeight, mEout);
set(handles.equalel,'String',outputArea);
clc;
end
end
Walter Roberson
Walter Roberson 2012년 1월 17일
Do you want the question addressed here or in your newer question http://www.mathworks.com/matlabcentral/answers/26268-can-you-help-me-how-to-interpolate-data-in-the-excel-table

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by