frequency - How to generate a positive square wave in matlab, whose cumulative sum should be equal to a given value? -
i have cumulative rain, r = 100 mm t = 10 days. want distribute r on t through square wave cumulative of square wave equal r. in fact, want generate different scenario changing frequency , duration of rainfall, however, cases, cumulative r should same.
please suggest.
regards,
imran
do on paper first - arguably maths question really.
the trick clear definitions (this why you're getting downvotes - same definitions required people give detailed help).
start definition of square wave fits requirements (i.e. 2 levels occupies). define cumulative , determine how compute it. should able write expression relates duty cycle of square wave (choose letter parameter) , total time period (your t) cumulative (your r). can invert relationship such that, given cumulative r , time t can recover required duty cycle.
when you've done you'll find great deal easier implement in matlab.
if have trouble of these stages ask new question it, remembering include you've tried far.