Error using * Inner matrix dimensions must agree.

1 次查看(过去 30 天)
Okay so I' trying put in the following commands.
%Constants%
hbar = 1.055e-34; %J s
c = 2.998e8; %m/s Speed of light
eps = 8.854e-12; %C^2/N/m^2 permitivity of free space
%system parameters%
W = 20e-6; %m Beam width
l = 300e-6; %m Beam length
h = 2e-6; %m Beam thickness
rho = 2.33e3; %kg/m^3 Material density (silicon)
E = 169e9; %Pa Youngs modulous
g = 8e-6; %m Initial gap distance
Q = 350 %Quality factor
V = 16; %V AC peak voltage
A = W*h; %m^2 Cross sectional area
I = W*h*h*h/12; %m^4 Cross sectional intertia
wn = 3.51562; %s^-1 natural frequency
%%%Constants from modeshapes%%%
g011 = 0.7830; % g011 = <1,phi_1>
g111 = 1; % g111 = <phi_1,phi_1>
g211 = 1.4778; % g211 = <phi_1^2, phi_1>
g311 = 2.3488; % g311 = <phi_1^3, phi_1>
%This constant tracks effects of Casimer Effect
%alpha = (pi*pi*hbar*c*W*l^4)/(240*g^5*E*I);
alpha = 0;
%This constant tracks effects of the Electrostatic Force
%delta =(eps*W*l^4)/(2*g^3*E*I)*V*V;
delta = .01;
%This constant tracks effects of Fringing Correction to Elec. Force
%f = 0.65*g/W;
f = 0.26;
%Dimensionless damping coeff.
%b0*l^2/g*sqrt(1/(rho*A*E*I));
%b = wn/Q
b = 0.001;
C1 = delta*(1+f)/2;
C2 = delta*(2+f)/2;
C3 = delta*(3+f)/2;
C4 = delta*(4+f)/2;
gamma=0.001:0.0001:pi;
amp = 2.*g111.*wn.*b./C3./g211./sin(gamma)-sqrt((2.*g111.*wn.*b./C3./g211./sin(gamma)).^2 - 4.*C1.*g011./C3./g211);
Where exactly should I put the periods so I don't get that error.
  2 个评论
Nalini Vishnoi
Nalini Vishnoi 2014-10-2
编辑:Nalini Vishnoi 2014-10-2
Please specify what are the values for b, alpha, delta, wn, g111 .
Valeria Garcia
Valeria Garcia 2014-10-2
oops! should have explained more. I already put them.

请先登录,再进行评论。

回答(1 个)

Star Strider
Star Strider 2014-10-2
We know gamma is a vector, but nothing about whether the other variables are vectors or scalars. In the absence of that information, just vectorise the entire expression unless you know specific operations involve only scalars.
Also, highlighting your code and then using the [{}Code] button makes it easier to read.

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by