Date: Dec 5, 2012 11:09 AM
Author: Matt
Subject: Vector definition using variables
Hello guys,

I am having the following problem when I want to use the following function :

--------------

tstep=0.1;

final_time=30;

vect1=0:tstep:final_time

--------------

So the vector produced should be 1x301 long. Now the problem is that my tstep value is defined like this :

--------------

tstep=((length(time)-1))/length(d)

--------------

Where time is a 1x301 vector so value for length(time) should be 301, and d is a 1x330 vector so the value for length(d) should be 330. Therefore the value for tstep should be (301-1)/330=0.909090

When I put this above value manually into vect1, it gives me the correct vector that I am looking for, but I'm using the tstep value given by the calculation above (using the length function), it doesn't work. It gives me a 1x34 vector for example.

Thanks a lot for your help I really have no idea what's wrong here ! :-)