Reconstruct 3D plot from X profile and Y profile

Essentially I am trying to reverse the process of getting a projection of the 3D plot. I have a projection along the x,z plane and a projection along the y,z plane. I want to combine those two projections to recreate a 2D plot (x,y plane) using color as the intensity representation. OR a 3D plot which I can then project onto the x,y plane. Specifically this is a gaussian beam profile. Note: the intensity scale of the two data sets are the exact same.
I have the following data:
X z-intensity y z-intensity
I assume a mesh or grid works best, but I am not sure how to go about this.
This is the image of my raw data:
This is the 2D plot that should look like concentric ellipses if the contour plot is plotted.
it appears my beam is split in half somewhere... Not sure where...
What I have is the following:
%%attempting to plot my raw data to confirm it imported correctly
x_axis = Data(:,1); %axis values
y_axis = Data(:,3); %axis values
x_int = Data (:,2); %intensity values
y_int = Data (:,4); %intensity values
[XZ,YZ] = meshgrid(x_int, y_int);
[X,Y] = meshgrid(x_axis,y_axis);
% A = NaN(726,726,726);
% A(:,363,:) = XZ;
% A(363,:,:) = YZ;
Matrix = NaN(726,726);
Matrix(363,:) = y_int;
Matrix(:,363) = x_int;
% SP3 = plot3(X,Y,Matrix);
xlabel('X-axis');
ylabel('Y-axis');
legend;
surfc(X,Y,Matrix); %Note: This is the only thing that seemed to work...
%plotting the raw data otherwise didn't seem to work correctly.
%% Now finding the 1/e^2 point of my gaussian to find the width for my equation
[maxindxy,maxvaly] = max(y_int);
[maxindxx,maxvalx] = max(x_int);
ny = maxindxy*.135;
nx = maxindxx*.135;
for q = 1:maxindxx
[val_x1,idx_x1] = min(abs(x_int-nx));
end
for w = maxindxx:NumDataLines
[val_x2,idx_x2] = min(abs(x_int-nx));
end
for e = 1:maxindxy
[val_y1,idx_y1] = min(abs(y_int-ny));
end
for r = maxindxy:NumDataLines
[val_y2,idx_y2] = min(abs(y_int-ny));
end
firstx = x_axis(idx_x1);
secx = x_axis(idx_x2);
firsty = y_axis(idx_y1);
secy = y_axis(idx_y2);
total_width_x = abs(firstx)+abs(secx);
total_width_y = abs(firsty)+abs(secy);
xx = total_width_x/2;
yy = total_width_y/2;
figure
SP3 = contour(exp((-(X.^2/xx.^2)+Y.^2/yy.^2))));
%I want to end up making a 2D plot with the color representing the power, rather than a single contour
%but the contour plot was giving me bound errors
xlabel('x-axis');
ylabel('y-axis');
legend;

Respuestas (0)

Categorías

Más información sobre Contour Plots en Centro de ayuda y File Exchange.

Preguntada:

el 13 de Nov. de 2020

Editada:

el 14 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by