How to generate random function with respect to time ??

조회 수: 6 (최근 30일)
Moataz Mohsen
Moataz Mohsen 2015년 3월 30일
댓글: Thomas Koelen 2015년 3월 30일
How to generate random function with respect to time knowing that the magnitude limit and time duration is predefined ????
  댓글 수: 1
Michael Haderlein
Michael Haderlein 2015년 3월 30일
What do you mean with random function with respect to time?

댓글을 달려면 로그인하십시오.

채택된 답변

Thomas Koelen
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
Moataz Mohsen
Moataz Mohsen 2015년 3월 30일
I want for example to generate random Power magnitudes for 2 hours time duration. So I can get at time equal 4 min. and 30 second the power is equal 50 Watt (for example)...........Is this work ?? and what is iT referring to ???
Thomas Koelen
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
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?
  댓글 수: 1
Moataz Mohsen
Moataz Mohsen 2015년 3월 30일
I want for example to generate random Power magnitudes for 2 hours time duration. So I can get at time equal 4 min. and 30 second the power is equal 50 Watt (for example)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by