Plotting a meesh?

조회 수: 6 (최근 30일)
Joshua Warhaft
Joshua Warhaft 2019년 11월 23일
댓글: Walter Roberson 2019년 11월 24일
Hello, I am wondering how I can plot a mesh and then plot a deformed meeh?
  댓글 수: 1
Walter Roberson
Walter Roberson 2019년 11월 24일
Joshua:
This forum is for public questions and public answers. The volunteers get pretty annoyed when question get removed after they spent the time investigating and writing up solutions.

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

채택된 답변

Thomas Satterly
Thomas Satterly 2019년 11월 23일
Without seeing your data, it's difficult to say exactly how you shoud go about representing your data. However, something like the code below should fit your needs
% Make a 50 x 50 grid that is 10 wide and 20 tall
[x, y] = meshgrid(linspace(0, 10, 50), linspace(0, 20, 50));
z = zeros(size(x)); % Surf() needs some "Z" axis data in order to make it look like a 2D mesh
% Plot the grid
figure();
hold on;
axis equal;
surf(x, y, z, 'FaceColor', 'none', 'EdgeColor', [0 0 0]); % Black edges
% Some displacement data (made up)
x_d = x * 0.05 .* (20 - y) * 0.05;
y_d = x.^2 * 0.01 .* (y * 0.05) - y * 0.5;
% Plot the displaced mesh on top of the original mesh
surf(x + x_d, y + y_d, z, 'FaceColor', 'none', 'EdgeColor', [1 0 0]); % Red edges
  댓글 수: 1
Thomas Satterly
Thomas Satterly 2019년 11월 23일
The approach above should work for your purposes. It looks like you still need your initial positions (x and y) to that you can add the displacements to get the resultant mesh.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by