MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

### Discover what MATLAB® can do for your career.

Asked by sibananda mohanty on 22 Nov 2012
```clc
clear all
var w;
alpha=0.05
mu=0.05;
ztap=0;
ztaa=sqrt(3*mu/(8*(1+mu)));
omegaa=(1/(1+mu));
a1=1-alpha;
a2=2*ztaa*omegaa+2*ztap+2*ztaa*omegaa*mu;
a3=omegaa^2+4*ztap*ztaa*omegaa+mu*omegaa^2+1;
a4=2*ztap*omegaa^2+2*ztaa*omegaa;
a5=omegaa^2;
A=a1*omegaa^2*w^4-a3*omegaa^2*w^2+a5*omegaa^2-a1*w^6+a3*w^4-a5*w^2+2*ztaa*omegaa*a4*w^2-2*ztaa*omegaa*a2*w^2;
B=a4*w^3-a2*w^3-a4*omegaa^2*w+a2*omegaa^2*w+2*ztaa*omegaa*w^5-2*ztaa*omeggaa*a3*w^3+2*ztaa*omegaa*w*a5;
C=(a1*w^4-a3*w^2+a5)^2+(a4*w-a2*w)^2;
G=sqrt(A^2+B^2)/C^2;
Q=@(w) G;
```

Walter Roberson on 22 Nov 2012

What error is it showing, at what line?

Are you sure that you want to calculate the variance of the string 'w' ? That is what

```var w;
```

will do. It is equivalent to

```var('w')
```

and var() is the variance function.

## Products

No products are associated with this question.

Answer by Walter Roberson on 22 Nov 2012

After fixing the var() issue, replace

```Q=@(w) G;
```

with

```Q = matlabFunction(G);
```