Common part of 2D and 3D plot

1 view (last 30 days)
M
M on 5 Jun 2022
Commented: Star Strider on 7 Jun 2022
Hi, I have a 3D plot that are plotted based on data (the data attached and shown with blue in the figure below), and a 2d curve on the yz plane. I want to know which part of 2d curve is on the 3d plot. here is the information for the figure:
For 2D plot on the yz: f=0.07.*z.^2./(0.09+z.^2) and g=0.003+0.01.*(42./(42+(y-z).^4)) and I want to plot g-f=0 in yz plane.
and 3D curve has data attached here. for example in this figure that is 3d I want to know where is the 2D curve on the yz plane that I showed. I would appreciate any help
A = importdata(curve3dfinal)

Accepted Answer

Star Strider
Star Strider on 5 Jun 2022
I am not certain what result you want.
It is straightforward to rotate the 3D plot to give a 2D view from the Z-axis —
Uz = unzip('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1022280/curve3dfinal.zip');
% type(Uz{1})
C3DF = readmatrix(Uz{1})
C3DF = 30001×3
0.0033 1.2649 0.4327 0.0033 1.2645 0.4327 0.0032 1.2640 0.4326 0.0032 1.2636 0.4326 0.0032 1.2632 0.4325 0.0032 1.2627 0.4325 0.0032 1.2623 0.4324 0.0032 1.2619 0.4323 0.0032 1.2614 0.4322 0.0032 1.2610 0.4321
x = C3DF(:,1);
y = C3DF(:,2);
z = C3DF(:,3);
figure
plot3(x, y, z)
grid on
view(20,30)
xlabel('X')
ylabel('Y')
zlabel('Z')
title('3D View')
figure
plot3(x, y, z)
grid on
view(0,90)
xlabel('X')
ylabel('Y')
zlabel('Z')
title('View From Z-Axis')
.
  13 Comments
M
M on 7 Jun 2022
Fantastic. Very appreciate...
I removed my comments that are not necessary
Star Strider
Star Strider on 7 Jun 2022
As always, my pleasure!
I finally figured it out!

Sign in to comment.

More Answers (1)

Sam Chak
Sam Chak on 6 Jun 2022
Edited: Sam Chak on 6 Jun 2022
HI @M
If the points of the desired function h are projected to the y–z plane, then the curve should look like this:
f = @(z) 0.07*z.^2./(0.09 + z.^2);
g = @(z, y) 0.003 + 0.01*(42./(42 + (y - z).^4));
fcn = @(z, y) g(z, y) - f(z);
fyz = fimplicit(fcn, [-0.15 0.15 -5 5]);
z = fyz.XData;
y = fyz.YData;
plot(y, z, 'linewidth', 1.5)
On 3D, I think the function looks like this:
h = 0.003 + 0.01*(42./(42 + (y - z).^4)) - (0.07*z.^2./(0.09 + z.^2));
plot3(y, z, h, 'linewidth', 1.0)

Categories

Find more on Contour Plots 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!