Thread Subject: Using Repmat for a periodic function

Subject: Using Repmat for a periodic function

From: jay singh

Date: 6 Dec, 2008 00:35:04

Message: 1 of 3

Hey guys, i'm new to matlab so this might be a really easy one for you experts out there but here's the situation :

A1=[3.8469*10^6];
B1=[325.6907];
C1=A1;
Ts=1e-4; t=[0.0:Ts:0.1]; num1=[A1]; den1=[1 B1 C1];
sys1=tf(num1, den1); h1=impulse(sys1,t);

x1=ones(5,1);
now with that being system, H1, we have to do the following:

Assume the input x2(t) to H1 is a periodic signal with the period T =
0:004. Over one period, say, from t = 0 to t = 0:004, the signal is denoted
as
x2(t)={ 1 0<=t<=5e-4
            0 5e-4<t<=0.004

Compute and plot the output y2(t) using MATLAB.
Hints: Create the input x2(t) and then use "y2=conv(x2, h1)*Ts".

now i'm having trouble getting my x2 function right and all i know is that x2 can be created pretty much in one line using the 'repmat' command but i'm not too sure of how the arguements would go...we have to plot this for 25 periods since T=0.004 and if u notice above, t goes upto 0.1s so that gives 25 periods.


this is the only part of the project that i'm stuck at and its due tomorrow. i'd really appreciate the help thanks

Subject: Using Repmat for a periodic function

From: Ryan Ollos

Date: 6 Dec, 2008 01:57:02

Message: 2 of 3

"jay singh" <drj_86@rediffmail.com> wrote in message <
> x2(t)={ 1 0<=t<=5e-4
> 0 5e-4<t<=0.004

You have your sampled function, and you just need to replicate it, right?

Ts = 1e-4;
t1 = 0:Ts:5e-4;
t2 = 5e-4:Ts:40e-4;
x2 = [ones(length(t1), 1); zeros(length(t2), 1)]; %periodic portion of signal

% replicate it n times
n = 25;
x2p = repmat(x2, n, 1);

Subject: Using Repmat for a periodic function

From: jay singh

Date: 7 Dec, 2008 06:25:03

Message: 3 of 3

Thanks alot Ryan..that worked perfectly!

"Ryan Ollos" <ryano@physiosonics.com> wrote in message <ghcm5e$87n$1@fred.mathworks.com>...
> "jay singh" <drj_86@rediffmail.com> wrote in message <
> > x2(t)={ 1 0<=t<=5e-4
> > 0 5e-4<t<=0.004
>
> You have your sampled function, and you just need to replicate it, right?
>
> Ts = 1e-4;
> t1 = 0:Ts:5e-4;
> t2 = 5e-4:Ts:40e-4;
> x2 = [ones(length(t1), 1); zeros(length(t2), 1)]; %periodic portion of signal
>
> % replicate it n times
> n = 25;
> x2p = repmat(x2, n, 1);

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com