×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

repeat wave- pls help!

repeat wave- pls help!

repeat wave- pls help!

(OP)
Does anyone know how to change the frequency of this square wave? I don't want to use the Matlab square(T) function. I'm pretty sure there is more code needed to add to this.
When I chenge the line y = [ones(L/2),zeros(L/2)]; to
y = [ones(L/4),zeros(L/4)]; it won't plot.
I'm stumped.
Thanks for help-
Tom

x = 1:100;
L = length(x);
y = [ones(L/2),zeros(L/2)];
plot(x,y)

RE: repeat wave- pls help!

Don't you think you need to fill y some more?  You've only assigned half the values

TTFN



RE: repeat wave- pls help!

Check the help information for the "ones" and "zeros" functions. The statement "ones(L/2)" produces a L/2 x L/2 matrix of ones NOT a L/2 x 1 vector of ones. Your variable y is of dimensions 50 x 100. Is that what you really want?

M

--
Dr Michael F Platten

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources