From: Taylor Jacobus on
So I tried to plot the following code for a mass spring damper system. I can't figure out where I went wrong when Indexing. I know its not the squared terms I checked and same error. I know the vector t is 1-D but when it tries to compute x it gives me the error. Any help would be appreciated.

_____________________________________________
clear all;
clc;

w=10;
z=0.1;
m=1;
d=w*sqrt(1-(z^2));

t=0:0.001:5;

x=-(1/m)*((-d+d*exp(-z*w*t).*cos(d*t)+z*w*exp(-z*w*t).*sin(d*t))...
/(d((z^2)*(w^2)+(d^2))));

plot(t,x);
legend('x(t)');
xlabel('time');
ylabel('position');
title('System Response to Step Input');
___________________________________________________________

??? Index exceeds matrix dimensions.
From: Stefan on
There it is:

> /(d((z^2)*(w^2)+(d^2))));

d( is indexing.

Regards,
Stefan
 | 
Pages: 1
Prev: gath geva algorithm
Next: datenum and data problem