Error using * Inner matrix dimensions must agree.

1 view (last 30 days)
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 Comments
Nalini Vishnoi
Nalini Vishnoi on 2 Oct 2014
Edited: Nalini Vishnoi on 2 Oct 2014
Please specify what are the values for b, alpha, delta, wn, g111 .
Valeria Garcia
Valeria Garcia on 2 Oct 2014
oops! should have explained more. I already put them.

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 2 Oct 2014
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.

Categories

Find more on Particle & Nuclear Physics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!