>> sf2 = .02; >> a = 12; >> sf2 = .2^2; >> omega = 0:.1:80; >> sff = sf2*a./(pi*(a^2+omega.^2)); >> plot(omega,sff) >> m = 1; >> k = 400; >> c = .05*sqrt(m*k); >> sxx = sff*(k^2+(c^2-2*k*m).*omega.^2+m^2*omega.^2).^(-1); ??? Error using ==> mtimes Inner matrix dimensions must agree. >> sxx = sff.*(k^2+(c^2-2*k*m).*omega.^2+m^2*omega.^2).^(-1); >> figure >> plot(omega,sxx) >> sxx = sff.*(k^2+(c^2-2*k*m)*omega.^2+m^2*omega.^4).^(-1); >> figure >> plot(omega,sxx) >> k = 200; >> c = .05*sqrt(m*k); >> sxx2 = sff.*(k^2 + (c^2-2*k*m)*omega.^2 + m^2*omega.^4).^(-1); >> hold Current plot held >> plot(omega,sxx2,'r') >> for i = 1:10 mrand(i) = randn*.1 +1; c = .05*sqrt(mrand(i)*k); sxxrand(i,:) = sff.*(k^2 + (c^2-2*k*mrand(i))*omega.^2 + mrand(i)^2*omega.^4).^(-1); end >> >> >> figure >> plot(omega,sxxrand) >> for i = 1:1000 mrand(i) = randn*.1 +1; c = .05*sqrt(mrand(i)*k); sxxrand(i,:) = sff.*(k^2 + (c^2-2*k*mrand(i))*omega.^2 + mrand(i)^2*omega.^4).^(-1); end >> >> >> figure >> whos Name Size Bytes Class Attributes a 1x1 8 double c 1x1 8 double i 1x1 8 double k 1x1 8 double m 1x1 8 double mrand 1x1000 8000 double omega 1x801 6408 double sf2 1x1 8 double sff 1x801 6408 double sxx 1x801 6408 double sxx2 1x801 6408 double sxxrand 1000x801 6408000 double >> hist(sxxrand(:,150)) >> for i = 1:10 mrand(i) = randn*.1 +1; c = .05*sqrt(mrand(i)*k); sxxrand(i,:) = sff.*(k^2 + (c^2-2*k*mrand(i))*omega.^2 + mrand(i)^2*omega.^4).^(-1); end >> >> for i = 1:10 mrand(i) = randn*.1 +1; krand(i) = randn*40+400; c = .05*sqrt(mrand(i)*krand(i)); sxxrand(i,:) = sff.*(krand(i)^2 + (c^2-2*krand(i)*mrand(i))*omega.^2 + mrand(i)^2*omega.^4).^(-1); end >> figure >> plot(omega,sxxrand) >> clear sxx >> clear sxxrand >> for i = 1:10 mrand(i) = randn*.1 +1; krand(i) = randn*40+400; c = .05*sqrt(mrand(i)*krand(i)); sxxrand(i,:) = sff.*(krand(i)^2 + (c^2-2*krand(i)*mrand(i))*omega.^2 + mrand(i)^2*omega.^4).^(-1); end >> figure >> plot(omega,sxxrand) >> figure >> plot(omega,sxxrand(1,:)) >>