フィルターのクリア

how to plot deformation on a cracked plate?

8 ビュー (過去 30 日間)
pooya azizi
pooya azizi 2023 年 9 月 18 日
コメント済み: Nathan Hardenberg 2023 年 9 月 23 日
I am trying to plot the displacement of a square plate under bending?
the length and width of plate is 0.4 m. I can plot displacement of perfect plate (without crack) with below code, but I don't know how can I plot a crack with two tips in positions:
start point:(x,y)=(0.2,0.25)
mid point (x,y)=(0.15,0.2)
and end point (x,y)=(0.1,0.15)
Then the middle point of the crack has two z values (one equal to -4.5 and another equal -5.649) to open the crack opening.
The figure I would like to draw is similar to the figure attached (46.jpg)
Please note that as shown in the attached figure, there should be a discontinuity at the place of the crack in the drawn figure
x=0:0.05:0.4;
y=0:0.05:0.4;
[X,Y]=meshgrid(x,y);
Z=[ 0 0 0 0 0 0 0 0 0;...
0 -0.9763 -1.7583 -2.2513 -2.4188 -2.2513 -1.7583 -0.9763 0;...
0 -1.7583 -3.1801 -4.0824 -4.3899 -4.0824 -3.1801 -1.7583 0;...
0 -2.2513 -4.0824 -5.2505 -5.6495 -5.2505 -4.0824 -2.2513 0;...
0 -2.4188 -4.3899 -5.6495 -6.0801 -5.6495 -4.3899 -2.4188 0;...
0 -2.2513 -4.0824 -5.2505 -5.6495 -5.2505 -4.0824 -2.2513 0;...
0 -1.7583 -3.1801 -4.0824 -4.3899 -4.0824 -3.1801 -1.7583 0;...
0 -0.9763 -1.7583 -2.2513 -2.4188 -2.2513 -1.7583 -0.9763 0;...
0 0 0 0 0 0 0 0 0;...
];
surf(X,Y,Z)
  2 件のコメント
dpb
dpb 2023 年 9 月 18 日
x=0:0.05:0.4;
y=0:0.05:0.4;
[X,Y]=meshgrid(x,y);
Z=[ 0 0 0 0 0 0 0 0 0;...
0 -0.9763 -1.7583 -2.2513 -2.4188 -2.2513 -1.7583 -0.9763 0;...
0 -1.7583 -3.1801 -4.0824 -4.3899 -4.0824 -3.1801 -1.7583 0;...
0 -2.2513 -4.0824 -5.2505 -5.6495 -5.2505 -4.0824 -2.2513 0;...
0 -2.4188 -4.3899 -5.6495 -6.0801 -5.6495 -4.3899 -2.4188 0;...
0 -2.2513 -4.0824 -5.2505 -5.6495 -5.2505 -4.0824 -2.2513 0;...
0 -1.7583 -3.1801 -4.0824 -4.3899 -4.0824 -3.1801 -1.7583 0;...
0 -0.9763 -1.7583 -2.2513 -2.4188 -2.2513 -1.7583 -0.9763 0;...
0 0 0 0 0 0 0 0 0;...
];
surf(X,Y,Z)
xlabel('X'), ylabel('Y')
P=[0.2,0.25; 0.15,0.2; 0.1,0.15];
hold on
ix=flip(find(ismembertol(x,P(:,1)))).';
iy=flip(find(ismembertol(y,P(:,2)))).';
pz=cell2mat(arrayfun(@(i,j)Z(i,j),ix,iy,'uni',0));
pxy = 3×2
0.2000 0.2500 0.1500 0.2000 0.1000 0.1500
pz = 3×1
-5.6495 -5.6495 -4.0824
plot3(P(:,1),P(:,2),pz,'r-','linewidth',3)
lets you put the line for the crack on the figure; the orientation here is such can't see much of it.
In order to have two different Z values at the same X,Y locations you'll have to introduce another pair of X,Y coordinates at the same location but with a different Z value; that will let you draw two lines of different height at the same location. But, the surface won't be distorted to reflect that displacement; you would need to know the displacemnt of the base plate up to the crack location in order to adjust those heights appropriately.
pooya azizi
pooya azizi 2023 年 9 月 19 日
Dear dpb
Thank you for your answer. Ufortunately, with your explanations, I don't understand how to plot the crack so that show the opening of the crack edges from each other similar the figure that was attached in the questions. Can you write the code that show it?
Can I please ask you to write this code?
Best regards

サインインしてコメントする。

採用された回答

Nathan Hardenberg
Nathan Hardenberg 2023 年 9 月 19 日
編集済み: Nathan Hardenberg 2023 年 9 月 19 日
Firstly I'm plotting a crack similar to the example image. This is done using two surf-plots and is easily possible since the crack is along one axis.
x=0:0.05:0.4;
[X1,Y1]=meshgrid(x, 0:0.05:0.2);
[X2,Y2]=meshgrid(x, 0.2:0.05:0.4);
Z1 = sin(X1*8).^2; % plot 1
Z2 = -sin(X2*8).^2; % plot 2
figure(1); clf; hold on; grid on;
surf(X1,Y1,Z1)
surf(X2,Y2,Z2)
view([-214.00 54.16]) % setting good camera view
Plotting a crack not along one axis is also possible, by plotting two plots in the same rage and entering NaN-values on the other side of the "seam". Since you now want to plot triangles and not ractangles, you have to use the trisurf()-function. Below is a handcrafted example that may help you. I choose to do an easy example since doing it with code might not be so trivial.
[x,y] = meshgrid(1:5,1:5);
z1 = [ % plot 1
1 1 1 1 1;
1 1 1 1 NaN;
1 1 0.7 NaN NaN;
1 1 NaN NaN NaN;
1 NaN NaN NaN NaN;
];
z2 = [ % plot 2
NaN NaN NaN NaN 1
NaN NaN NaN 1 1;
NaN NaN 0.1 0 0;
NaN 1 0 0 0;
1 1 0 0 0;
];
T = delaunay(x,y);
figure(2); clf; hold on; grid on;
trisurf(T,x,y,z1,"FaceColor","interp")
trisurf(T,x,y,z2,"FaceColor","interp")
view([-214.00 54.16])
-- EDIT --
I also just now had another idea. You can maybe plot with the regular surf function, but supply NaNs in and around the area of the crack. Then you just need the area of the crack to be plotted with the trisurf method descridbed above
  4 件のコメント
dpb
dpb 2023 年 9 月 23 日
Alternatively, introduce a set of dummy coordinates +/-eps() away from the actual; will not be identically the same but close enough to look like it on the figure. Then you can introduce the "discontinuity" into the same surf().
But, as in the other, it may not be as simple to code as it is to describe--this will take introducing a new set of coordinates into the original.
Nathan Hardenberg
Nathan Hardenberg 2023 年 9 月 23 日
@pooya azizi sadly I do not have the time to write such code you suggest. And how to write the code also depends highly on the usecase. You seem to have quite a simple exaple, where manually creating the matricies might be feasable. And by manually I do not neccessarily mean writing by hand, but having NaN-Masks or something similar.
If such a behaviour should be more general, this task gets much more complicated, and then it also would not be enough to simply supply start, end and one midpoint. You would need some kind of format to describe the crack better.
Also the method described is not limited to work with a crack only beeing in the center. Also it does not need to be at 45°, but it will be if the grid is rectangular.
But if you still want a genral solution definetly check out the delaunay() function, to get "better" cracks.
Best regards and good luck :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLine Plots についてさらに検索

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by