How to generate random function with respect to time ??
3 次查看(过去 30 天)
显示 更早的评论
How to generate random function with respect to time knowing that the magnitude limit and time duration is predefined ????
1 个评论
采纳的回答
Thomas Koelen
2015-3-30
clc
clear all
close all
sf=50;
time=60;
mag=1;
S=zeros(1,sf*time);
for iT=1:length(S)
S(iT)=-mag+2*rand*mag;
end
where sf is your sample frequency, time is your time, and mag is your magnitude. S is the signal.
2 个评论
Thomas Koelen
2015-3-30
so you change your time to 7200, your mag to 50. you might want to change mag+2*rand*mag to just rand*mag since you are talking about power. if you want to look what the power was at that time you simply do: S(4.5*60).
更多回答(1 个)
Mahdiyar
2015-3-30
There are many random function that you may use, such as randperm, randi and so on. Can you explore more what you want to implement?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Random Number Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!