Clear Filters
Clear Filters

how to do regression in rows and interpolation in columns in 2d matrices

2 views (last 30 days)
i am using matlab to do interpolation and regression in 3 different matrices with the same size. the matrices call angle, rotation and error.
i need to do the 3rd order polynomial regression in rows of rotation(=x) and error(=y) matrices and save the new error data az y', then do the linear interpolation in column of angle(=x) and y' matrices and at the end plot the (angle(=x), rotation(=y), error(=z)) in 3d space.
for the regression i am using polyfit and polyval functions and find the polynomial coefficent matrix and y' matrix but for the second step when i use F=TriScatteredInterp(x,y,z) this function interpolate the data in 2 dimention, it means the points that i got from regression are changing , but i dont want that.i wanna the regression that i have done in the rows and acquired points dont change.
could you please help me with that, how can i do the regression in rows and interpolation in columns and plot the graph in much more detail than the data points that i have?
here is the last part of my program, where i have used the funcion F:
x=transpose(angle);
y=transpose(rotation);
z=transpose(Metx1); % error function after regression
F = TriScatteredInterp(x,z);
ti = -150:1:150;
ti1 = -40:1:40;
[qx,qy] = meshgrid(ti1,ti);
qz = F(qx,qy)
surf(qx,qy,qz);
colormap bone
hold on;
stem3(x,y,z,'fill','r');

Answers (0)

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!