interpolation of scatter data
Show older comments
Hi, I am new in Matlab and I have difficulty in solving this problem. I have a matrix as bellow where Fd is a function of Id and Iq and also Fq is a function of Id and Iq. I want to extend my results for a 128*128 matrix of Id and Iq. The code that I used is as:
Id_vector = linspace(-200,0,128);
Iq_vector = linspace(-200,0,128);
[ Id , Iq ] = meshgrid(Id_vector,Iq_vector);
but I can not create a function for Fd and Fq using two variables. I tried the interp1 and ppval without any success. would you please help me?
Id Iq Fd Fq
0 0 0.001 -0.172
-50.0 0 0.001 -0.186
-100 0 0.001 -0.196
-150 0 0.001 -0.204
-200 0 0.001 -0.210
0 -50 -0.020 -0.172
-50 -50 -0.019 -0.186
-100 -50 -0.017 -0.196
-150 -50 -0.016 -0.204
-200 -50 -0.015 -0.210
0.0 -100.0 -0.042 -0.171
-50.0 -100.0 -0.039 -0.185
-100.0 -100.0 -0.036 -0.195
-150.0 -100.0 -0.034 -0.203
-200.0 -100.0 -0.032 -0.209
0.0 -150.0 -0.064 -0.168
-50.0 -150.0 -0.060 -0.182
-100.0 -150.0 -0.056 -0.192
-150.0 -150.0 -0.052 -0.200
-200.0 -150.0 -0.049 -0.206
0.0 -200.0 -0.085 -0.164
-50.0 -200.0 -0.079 -0.178
-100.0 -200.0 -0.074 -0.188
-150.0 -200.0 -0.069 -0.196
-200.0 -200.0 -0.065 -0.203
Accepted Answer
More Answers (1)
KSSV
on 4 May 2018
A = [0 0 0.001 -0.172
-50.0 0 0.001 -0.186
-100 0 0.001 -0.196
-150 0 0.001 -0.204
-200 0 0.001 -0.210
0 -50 -0.020 -0.172
-50 -50 -0.019 -0.186
-100 -50 -0.017 -0.196
-150 -50 -0.016 -0.204
-200 -50 -0.015 -0.210
0.0 -100.0 -0.042 -0.171
-50.0 -100.0 -0.039 -0.185
-100.0 -100.0 -0.036 -0.195
-150.0 -100.0 -0.034 -0.203
-200.0 -100.0 -0.032 -0.209
0.0 -150.0 -0.064 -0.168
-50.0 -150.0 -0.060 -0.182
-100.0 -150.0 -0.056 -0.192
-150.0 -150.0 -0.052 -0.200
-200.0 -150.0 -0.049 -0.206
0.0 -200.0 -0.085 -0.164
-50.0 -200.0 -0.079 -0.178
-100.0 -200.0 -0.074 -0.188
-150.0 -200.0 -0.069 -0.196
-200.0 -200.0 -0.065 -0.203] ;
Id = A(:,1) ; Iq = A(:,2) ; Fd = A(:,3) ;Fq = A(:,4) ;
% Do interpolation
Id_vector = linspace(-200,0,128);
Iq_vector = linspace(-200,0,128);
[ Idi , Iqi ] = meshgrid(Id_vector,Iq_vector);
F1 = scatteredInterpolant(Id,Iq,Fd) ;
Fdi = F1(Idi,Iqi) ;
F2 = scatteredInterpolant(Id,Iq,Fq) ;
Fqi = F2(Idi,Iqi) ;
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!