Plotting Mode Shapes
31 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi All. I am wondering if someone may explain to me how I should plot the mode shapes of function if the function basically has two variables say x and y. The function is described as sin(pi*x/a).*sin(pi*y/b)where a and b are constants and pi is in radians. I tried using the contour function and the program tells me the function Z has to be 2x2 or greater which leaves me blank. I have written the code below if one wants to take a look. I appreciate any assistance:
clear all
clc
format short e
syms
%%Data:
EL = 38.6e9;
GLT = 4.14e9;
ET = 8.27e9;
vLT = 0.26;
rho = 1.8;
a = 1;
b = 0.5;
H = 0.005;
n = 2;
h = H/n;
h0 = 0;
h1 = h0+h;
h2 = h1+h;
x = linspace(-10,10,1);
y = linspace(-10,10,1);
%%Calculate vTL and rho_0:
vTL = (vLT*ET)/EL;
rho_0 = rho*h*(h1-h0) + rho^2*h*(h2-h1);
%%1st Layer:
%%Calculate Transformation Matrix:
Theta = 90;
Theta = (Theta*pi)/180;
m = cos(Theta);
n = sin(Theta);
T1 = [m^2 n^2 2*m*n;n^2 m^2 -2*m*n;-m*n m*n m^2-n^2];
T2 = [m^2 n^2 m*n;n^2 m^2 -m*n;-2*m*n 2*m*n m^2-n^2];
%%Calculate Q Matrix:
Q11 = EL/(1-vLT*vTL);
Q12 = (ET*vLT)/(1-vLT*vTL);
Q22 = ET/(1-vLT*vTL);
Q66 = GLT;
Q = [Q11 Q12 0;Q12 Q22 0;0 0 Q66];
%%Calculate Q_bar Matrix:
Q_Bar_90 = inv(T1)*Q*T2;
%%2nd Layer:
%%Calculate Transformation Matrix:
Theta = 0;
Theta = (Theta*pi)/180;
m = cos(Theta);
n = sin(Theta);
T1 = [m^2 n^2 2*m*n;n^2 m^2 -2*m*n;-m*n m*n m^2-n^2];
T2 = [m^2 n^2 m*n;n^2 m^2 -m*n;-2*m*n 2*m*n m^2-n^2];
%%Calculate Q Matrix:
Q11 = EL/(1-vLT*vTL);
Q12 = (ET*vLT)/(1-vLT*vTL);
Q22 = ET/(1-vLT*vTL);
Q66 = GLT;
Q = [Q11 Q12 0;Q12 Q22 0;0 0 Q66]
%%Calculate Q_bar Matrix:
Q_Bar_0 = inv(T1)*Q*T2;
%%Calculate the D Matrix:
D11 = (1/3)*Q_Bar_90(1,1)*(h1^3-h0^3)+(1/3)*Q_Bar_0(1,1)*(h2^3-h1^3);
D12 = (1/3)*Q_Bar_90(1,2)*(h1^3-h0^3)+(1/3)*Q_Bar_0(1,2)*(h2^3-h1^3);
D16 = (1/3)*Q_Bar_90(1,3)*(h1^3-h0^3)+(1/3)*Q_Bar_0(1,3)*(h2^3-h1^3);
D21 = (1/3)*Q_Bar_90(2,1)*(h1^3-h0^3)+(1/3)*Q_Bar_0(2,1)*(h2^3-h1^3);
D22 = (1/3)*Q_Bar_90(2,2)*(h1^3-h0^3)+(1/3)*Q_Bar_0(2,2)*(h2^3-h1^3);
D26 = (1/3)*Q_Bar_90(2,3)*(h1^3-h0^3)+(1/3)*Q_Bar_0(2,3)*(h2^3-h1^3);
D16 = (1/3)*Q_Bar_90(3,1)*(h1^3-h0^3)+(1/3)*Q_Bar_0(3,1)*(h2^3-h1^3);
D26 = (1/3)*Q_Bar_90(3,2)*(h1^3-h0^3)+(1/3)*Q_Bar_0(3,2)*(h2^3-h1^3);
D66 = (1/3)*Q_Bar_90(3,3)*(h1^3-h0^3)+(1/3)*Q_Bar_0(3,3)*(h2^3-h1^3);
D = 2*[D11 D12 D16;D12 D22 D26;D16 D26 D66]
%%First Frequency:
m = 1;
n = 1;
w11 = sqrt((pi^4/rho_0)*(D11*(m/a)^4+2*(D12+2*D66)*(m/a)^2*(n/b)^2+D22*(n/b)^4))
Mode11 = sin(pi*x/a).*sin(pi*y/b);
contour(x,y,Mode11)
%%Second Frequency:
m = 1;
n = 2;
w12 = sqrt((pi^4/rho_0)*(D11*(m/a)^4+2*(D12+2*D66)*(m/a)^2*(n/b)^2+D22*(n/b)^4))
Mode12 = Mode11 + sin(pi*x/a).*sin(pi*y/b);
%%Third Frequency:
m = 1;
n = 3;
w13 = sqrt((pi^4/rho_0)*(D11*(m/a)^4+2*(D12+2*D66)*(m/a)^2*(n/b)^2+D22*(n/b)^4))
Mode13 = Mode11 + Mode12 + sin(pi*x/a).*sin(pi*y/b);
And here is what I get after running the code:
??? Error using ==> contour at 73
Z must be size 2x2 or greater.
Error in ==> qn_b at 82
contour(x,y,Mode11)
Thank you.
0 Kommentare
Antworten (1)
Muhammad Sardar Khan
am 20 Apr. 2015
Bearbeitet: Muhammad Sardar Khan
am 20 Apr. 2015
refer to this line: Mode11 = sin(pi*x/a).*sin(pi*y/b); since x and y are vectors created by the linspace function above. The multiplication will require a dot, because multiplication of pi with each element is required. As this expression will enter into the contour plot as a variable Z, and mandatory requirement for Z is such that it has size of 2x2 or more, best luck!
1 Kommentar
Manish Chauhan
am 1 Sep. 2020
put this
%x=linspace(0,a,100);
% y=linspace(0,b,100);
% [xx,yy]=meshgrid(x,y);
and change Mode11 = sin(m*pi*x/a).*sin(*pi*y/b);
put x to xx and y to yy
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!