|
|
How to create a unit step function??
I need to plot the following: x1(t)= tu(t)-tu(t-1)
this is what i've done so far to deal with the u(t-1) part:
(disregard the numbers here as i've yet to define my interval)
u=zeros(11,1);
u(6:end)=1;
this gives me a column with the first five rows being 0 and the rest 1
i thought i could multiply this with t to get the desired effect, but understandably i get an 11x11 matrix and i can't really plot this vs time
please help...
|
|
0
|
|
|
|
Reply
|
Miguel
|
1/12/2011 5:36:05 AM |
|
"Miguel Bustelo" wrote in message <igjek5$3jc$1@fred.mathworks.com>...
> I need to plot the following: x1(t)= tu(t)-tu(t-1)
>
> this is what i've done so far to deal with the u(t-1) part:
> (disregard the numbers here as i've yet to define my interval)
> u=zeros(11,1);
> u(6:end)=1;
>
> this gives me a column with the first five rows being 0 and the rest 1
>
> i thought i could multiply this with t to get the desired effect, but understandably i get an 11x11 matrix and i can't really plot this vs time
>
>
> please help...
http://www.mathworks.com/help/toolbox/control/ref/lsim.html
|
|
0
|
|
|
|
Reply
|
Husam
|
1/12/2011 5:54:05 AM
|
|
"Husam Aldahiyat" wrote in message <igjfls$a57$1@fred.mathworks.com>...
> "Miguel Bustelo" wrote in message <igjek5$3jc$1@fred.mathworks.com>...
> > I need to plot the following: x1(t)= tu(t)-tu(t-1)
> >
> > this is what i've done so far to deal with the u(t-1) part:
> > (disregard the numbers here as i've yet to define my interval)
> > u=zeros(11,1);
> > u(6:end)=1;
> >
> > this gives me a column with the first five rows being 0 and the rest 1
> >
> > i thought i could multiply this with t to get the desired effect, but understandably i get an 11x11 matrix and i can't really plot this vs time
> >
> >
> > please help...
>
> http://www.mathworks.com/help/toolbox/control/ref/lsim.html
lsim(sys,u,t)
this actually worked:
laplace of t = 1/s^2 so:
H=tf([10],[1 0 0])
Transfer function:
10
---
s^2
>> t=0:.01:10;
>> u=zeros(100,1);
>> u=zeros(1000,1);
>> u(100:end)=1;
>> lsim(H,u,t)
??? Error using ==> lti.lsim at 117
When simulating the response to a specific input signal, the input data U
must be a matrix with as many rows as samples in the time vector T, and as
many columns as input channels.
>> u=zeros(1001,1);
>> u(101:end)=1;
>> lsim(H,u,t)
>>
and i got the plot
--------
but thats only when i take that last part of the equation x1(t)= tu(t)-tu(t-1)
how do i plot for all of that^
....and i can't have MATLAB simply directly plot this because i need x1(t) to be defined so i can convolute it with another function.
|
|
0
|
|
|
|
Reply
|
Miguel
|
1/12/2011 6:32:04 AM
|
|
"Husam Aldahiyat" wrote in message <igjfls$a57$1@fred.mathworks.com>...
> "Miguel Bustelo" wrote in message <igjek5$3jc$1@fred.mathworks.com>...
> > I need to plot the following: x1(t)= tu(t)-tu(t-1)
> >
> > this is what i've done so far to deal with the u(t-1) part:
> > (disregard the numbers here as i've yet to define my interval)
> > u=zeros(11,1);
> > u(6:end)=1;
> >
> > this gives me a column with the first five rows being 0 and the rest 1
> >
> > i thought i could multiply this with t to get the desired effect, but understandably i get an 11x11 matrix and i can't really plot this vs time
> >
> >
> > please help...
>
> http://www.mathworks.com/help/toolbox/control/ref/lsim.html
i also don't have that heaviside function available
|
|
0
|
|
|
|
Reply
|
Miguel
|
1/12/2011 6:42:05 AM
|
|
|
3 Replies
2117 Views
(page loaded in 0.046 seconds)
|
|
|
|
|
|
|
|
|