how to Create random signal

random signal how to

1 comentario

the cyclist
the cyclist el 13 de Jul. de 2015
There are many types of random signals. You need to be more specific. For example, I assume that the wind (red points) is autocorrelated in some way, and that the load (blue points) is correlated with the wind. Can you provide some details about that?

Iniciar sesión para comentar.

 Respuesta aceptada

Star Strider
Star Strider el 13 de Jul. de 2015

0 votos

With the information from your latest Comment, one possibility is:
t = 0:200;
smax = 1.5;
smin = -0.8;
s = smin + (smax-smin)*rand(1,length(t));
figure(1)
plot(t, s)
grid

7 comentarios

Na Ka
Na Ka el 13 de Jul. de 2015
Thanks alot, I got it, once more thanks
Star Strider
Star Strider el 13 de Jul. de 2015
My pleasure.
Na Ka
Na Ka el 13 de Jul. de 2015
Editada: Na Ka el 13 de Jul. de 2015
excuse me dear Star Strider, If i want to put this data in a matrice What should I do? for example I want to solve this equation on the random figure, F(x)=2S(t)+2 for t=2 if i have the random data in a matrics, the f(x) looks for t=2 and put S(2) in the function.
Star Strider
Star Strider el 13 de Jul. de 2015
It is a vector, not a matrix, but it could be considered an array as well, depending on your definition.
There are several ways to evaluate your ‘F’ function, this is one:
t = 0:200;
smax = 1.5;
smin = -0.8;
s = smin + (smax-smin)*rand(1,length(t));
F = 2*s + 2; % Define: ‘F(t)’
figure(1)
plot(t, s, t, F)
grid
t2 = find(t == 2); % Find index for ‘t=2’
Ft2 = F(t2) % F(t=2)
Since this is random, ‘Ft2’ will change each time you run the code (unless you use the rng function to define the random-number generator seed to be the same for each run of your code).
Star Strider
Star Strider el 13 de Jul. de 2015
My pleasure.
Star Strider
Star Strider el 14 de Jul. de 2015
Apologise for the delay — life intrudes.
I believe you intend ‘transfer function’.
To use it with the signal I programmed, you will have to create a discrete expression of your transfer function, from ‘s’ to ‘z’. I would use the bilinear transform. Then use the filtfilt function for the actual filtering. (Your transfer function would actually be a filter in this instance.) If you have the Signal Processing Toolbox, all this is relatively straightforward but will take some time to learn if you are not familiar with it.
The MATLAB documentation, along with most signal processing textbooks, go into sufficient detail to allow you to do the conversion to the discrete form of your filter and the subsequent filtering relatively easily. It is much too involved for me to go into here, so I will refer you to the documentation and your textbooks.
Ionut Miller
Ionut Miller el 3 de Jun. de 2020
ty man you are a beast

Iniciar sesión para comentar.

Más respuestas (3)

Azzi Abdelmalek
Azzi Abdelmalek el 13 de Jul. de 2015

0 votos

Create a mat file like this one
t=0:0.1:10
y=rand(1,numel(t))
ty=[t;y]
save filename ty
In your simulink model add the from file block and set the file name to your mat-file name

2 comentarios

ali al-khayyat
ali al-khayyat el 24 de Ag. de 2019
Can you please generate triangle or carrier signal starts from 0 to 60 degree and stops and then starts from 120 to 180 and then repeat itself, either by coding or simulink, please?
the cyclist
the cyclist el 24 de Ag. de 2019
This question and answer are over 4 years old. I suggest you open a new question.

Iniciar sesión para comentar.

Muhammad Tayyab
Muhammad Tayyab el 29 de En. de 2021

0 votos

𝑋(𝑡)=𝐴𝑐𝑜𝑠(2𝜋𝑓𝑐𝑡+Θ)+𝑊(𝑡)
i want to generate this signal. kind help required

2 comentarios

Muhammad Tayyab
Muhammad Tayyab el 29 de En. de 2021
𝑋(𝑡)=𝐴𝑐𝑜𝑠(2𝜋𝑓𝑐𝑡+Θ)+𝑊(𝑡)
Θ uniformly random [-pi, pi]
W(𝑡) is Guassian with mu=0 & sigma=No/2
Les Beckham
Les Beckham el 30 de En. de 2021
You should really open a new question instead of inserting your question as an answer to a 6 year old question.
If you provide the code that you have written to try to solve your problem and show us what errors you get when your run it, you are likely to get someone to help you fix it. If you appear to be asking us to do all of the work for you, you will be less likely to get help.

Iniciar sesión para comentar.

KAVITHA
KAVITHA el 12 de Jun. de 2024

0 votos

t=0:0.1:10
y=rand(1,numel(t))
ty=[t;y]
save filename ty

Etiquetas

Aún no se han introducido etiquetas.

Preguntada:

el 13 de Jul. de 2015

Respondida:

el 12 de Jun. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by