필터 지우기
필터 지우기

graph the parametric surfaces

조회 수: 5 (최근 30일)
Lee
Lee 2024년 3월 20일
답변: Hassaan 2024년 3월 20일
How do create the graph for the parametric surfaces?
My codes as below but it can't run properly.
% Define the parametric surface function r(u,v)
r = @(u,v) [u.*v.^(-2); u.^(-2).*v; (u.^(-2) - v.^(-2))];
% Define the range of u and v
u = linspace(0.1, 2, 50); % Adjust the range and number of points as needed
v = linspace(0.1, 2, 50);
% Create a grid of (u,v) values
[U, V] = meshgrid(u, v);
% Evaluate the parametric surface function at each point on the grid
x = r(U, V);
% Plot the surface
surf(X, Y, Z, 'EdgeColor', 'none');
Unrecognized function or variable 'X'.
xlabel('x');
ylabel('y');
zlabel('z');
title('Parametric Surface: r(u,v) = (u*v^(-2))*i + (u^(-2)*v)*j + ((u^(-2) - v^(-2)))*k');
  댓글 수: 1
Chuguang Pan
Chuguang Pan 2024년 3월 20일
You should use three different surface function , , . Instead of using just one function to repensent three components of vector fields.

댓글을 달려면 로그인하십시오.

답변 (1개)

Hassaan
Hassaan 2024년 3월 20일
% Define the parametric surface function r(u,v)
r = @(u,v) [u.*v, u.*v.^(-2); u.*v.^(-2), u.^(-2) - v.^(-2)];
% Define the range of u and v
u = linspace(0.1, 2, 50); % Adjust the range and number of points as needed
v = linspace(0.1, 2, 50);
% Create a grid of (u,v) values
[U, V] = meshgrid(u, v);
% Evaluate the parametric surface function at each point on the grid
% r is a function that returns a 2x2 matrix, but for plotting surfaces we need to evaluate three functions r_x, r_y, r_z for X, Y, Z coordinates.
R = r(U, V);
% Extract individual components for X, Y, Z coordinates
X = U .* V; % r_x component: u*v
Y = U .* V.^(-2); % r_y component: u*v^(-2)
Z = U.^(-2) - V.^(-2);% r_z component: u^(-2) - v^(-2)
% Plot the surface
surf(X, Y, Z, 'EdgeColor', 'none');
% Labeling the axes
xlabel('x');
ylabel('y');
zlabel('z');
title('Parametric Surface: r(u,v) = (uv)i + (u*v^(-2))j + (u^(-2) - v^(-2))k');
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by