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: Piecewise function loop?
Replies: 2   Last Post: Jun 5, 2012 4:30 PM

Advanced Search

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

Posts: 1
Registered: 6/5/12
Piecewise function loop?
Posted: Jun 5, 2012 12:58 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I'm new to matlab and I would like to create an input function that depends on time and 1/frequency. That is, I would like to write a code that plots a sinusoidal increase for five minute blocks and then decreases exponentially until the next pulse comes. (Pulses are initiated at integer multiples of the period.)

So, something like this, which doesn't work:

% A((n.*g <= A) & (A < (n.*g + 5))) = 50.*sin( pi .* (A((n.*g <= A) & (A < (n.*g + 5))) + n.*g)/10);
%
% A(((n.*g + 5) <= A) & (A < (n + 1).*g)) = exp(-(A(((n.*g + 5) <= A) & (A < (n + 1).*g)) + (pi.*log(1/50) - (5 + n*g)))/pi);

What's the best way to code this?

Thank you!



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

[Privacy Policy] [Terms of Use]

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