Convert data from a 3d residual plot to a matrix?

5 visualizzazioni (ultimi 30 giorni)
Hello,
I have created a 3d residual plot from point cloud data. How can i now export these new residual x,y,z values as a 3 column matrix to do further work with?
As you can see from the image the residual plot at the moment is visually unclear due to the large amount of data points.
Any advice would be helpful. Thanks
Joe
%%Fit: 'Residual'.
[xData, yData, zData] = prepareSurfaceData( Dx3, Dy4, Dz2 );
% Set up fittype and options.
ft = fittype( 'poly55' );
opts = fitoptions( 'Method', 'LinearLeastSquares' );
opts.Normalize = 'on';
opts.Robust = 'Bisquare';
% Fit model to data.
[fitresult, gof] = fit( [xData, yData], zData, ft, opts);
% Plot residuals.
figure( 'Name', 'Residual Plot' );
plot( fitresult, [xData, yData], zData,'Style', 'Residual');
% Label axes
xlabel 'x (m)'
ylabel 'y (m)'
zlabel 'z (m)'
grid on
view( 0, 90 );
Dx3,Dy4,Dz2. These are the column vectors describing the intial raw data.
The code currently plots a fit to this data. Then creates a residual plot (plotting the points again above and below the fit).
So I am trying to extract these 'residual' points as a new set of data as 3 column vectors representing x,y and z or all together in a r column matrix.

Risposta accettata

Joe Pashley
Joe Pashley il 23 Ott 2018
Modificato: Joe Pashley il 23 Ott 2018
I sorted this by instead of plotting the residual. I used fitresult to extract the z data of the fitted data points. Then I subtracted the original points away from the fit. This was then into a matrix with the same width of x/y data. This gives me a mesh of the residual plot.
%calcualte z data of fit
fitresultZ = fitresult(xData,yData);
%calcualte z data of raw data - sfit z data
Dzformremove = Dz2 - fitresultZ;
%plot as mesh
Dformremovemesh = vec2mat(Dzformremove,512);
mesh(Dformremovemesh);

Più risposte (1)

madhan ravi
madhan ravi il 19 Ott 2018
Modificato: madhan ravi il 19 Ott 2018
3_column_matrix = [ x(:) y(:) z(:) ]
  6 Commenti
Joe Pashley
Joe Pashley il 19 Ott 2018
Sure I can, but the data is rather large though each is a 262,144 column vector. I have attached my code and an excel file that the code reads which contains the raw data.
My end goal is to turn the residual data into some kind of contour plot or 3d scatter plot.
madhan ravi
madhan ravi il 19 Ott 2018
We have to wait for someone who can proceed further , im finding it difficult to interpret

Accedi per commentare.

Categorie

Scopri di più su Fit Postprocessing in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by