Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Vector definition using variables
Replies: 4   Last Post: Dec 7, 2012 6:55 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,296
Registered: 6/7/07
Re: Vector definition using variables
Posted: Dec 5, 2012 2:08 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 12/5/2012 12:14 PM, Matt wrote:
> Thank you for your answer Steven.
>
> I would expect the value of vect1 to be 1x330.
>
> What I don't understand is that using the tstep formula, it gives me
> something like 0.9 (300/330).
>
> My problem is that I have defined a final_time value to top the
> simulation. But it happens that the value of d for example has more
> columns than the vector time. For example d can be 1x400 and time still
> stays 1x301.
>
> So I need to "rescale" the vector time, and that's why I want to use a
> different time step, so both vectors can have the same length and can be
> plotted together.


Well the problem w/ the above ratio is it is simply the ratio of the two
vector lengths but not scaled by the time span (either based on the full
length or that of the initial vect1). So, you computed a ratio of two
lengths but didn't adjust the dT to go along with it.

>> tstep=0.1;f_time=30;vect1=0:tstep:f_time;
>> tstep=tstep*300/330;
>> vect2=0:tstep:f_time;
>> length(vect2)

ans =
331
>>

You might look at

doc linspace

--




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.