Plotting Mode Shapes/ Wave Function
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to plot modes shapes, but my plot keeps appearing blank and I can't figure out what I'm doing wrong. Specifically, I am trying to plot position(x) as my x-axis, displacement(u) as my y-axis, and get a plot that appears sinusoidal. I have tried setting x = 1:0.5:5, but then I just get an error. What can I do to get this code to display a wave function like it should?
clear all;
format long;
im = sqrt(-1);
CellLength = 1;
ibeta = 1;
%Define materal properties
CellLength = 1;
layers = 2;
d1 = 0.4;
d2 = 0.6;
dTotal = d1+d2;
Ef = 12;
pf = 3;
cf = sqrt(Ef/pf);
Em = 1;
pm = 1;
cm = sqrt(Em/pm);
w = 5;
T1 = [cos(.2*w) (1/(6*w))*sin(.2*w); -6*w*sin(.2*w) cos(.2*w)];
T2 = [cos(.6*w) (1/w)*sin(.6*w); -w*sin(.6*w) cos(.6*w)];
T = T2*T1;
%Solve eigenvalue problem for k
[V,D] = eig(T);
k1 = log(D(1,1))/(im*dTotal);
k2 = log(D(2,2))/(im*dTotal);
B1 = [1 1; im*6*w -im*6*w];
a1 = inv(B1)*V(:,1);
x = 1;
u = [exp(im*k1*x) exp(-im*k1*x)]*a1;
plot(x,real(u))
0 commentaires
Réponse acceptée
KSSV
le 3 Avr 2018
Replace last three lines by:
x = 1:0.5:5;
u = [exp(im*k1*x); exp(-im*k1*x)].*a1;
plot(x,real(u),'r')
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Calculus dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!