Design an Input Signal
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Heraldo Tello
el 8 de Dic. de 2020
Comentada: Image Analyst
el 9 de Dic. de 2020
Hello everyone,
I am tasked with creating a PRBS signal without using matlab shortcuts. Please see below. Once I create this PRBS signal I will run it through a p-code file and get an output. I am supposed to plot the system input vs time. It should look like the second picture.
Here is the code I have so far. I attempted to create a random signal and then run it through the transfer function.
My code is probably wrong so it is definitly not set in stone.
I do not know how to make the signal look almost digital. The example shows the input signal is either negative 1 or positive 1.
When I ran my code, I got two figures back. Please see below.
Any help or direction is greatly appreciated.
clear all
close all
clc
fs=300; % Sampling Frequency in Hz
t_final=1140; % Overall test duration in seconds
time=0:1/fs:t_final;
time=time';
fc=1000;
Wc=2*pi()*fc;
num=0.27;
den=[1 0.95*Wc 1.4*Wc^2 0.74*Wc^3 0.27*Wc^4];
G = tf(num,den)
x1=rand(length(time),1);
U = lsim(G,x1,time);
[Y]=MysterySystem(time,U);
figure
plot(time,Y,'linewidth',2)
xlabel('Time (seconds)')
ylabel('Output (dimensionless)')
title('Heraldo Tello - Experimental Testing of the Unknown System')
grid on
figure
plot(time,U)
0 comentarios
Respuesta aceptada
Image Analyst
el 8 de Dic. de 2020
You might look at fewer seconds so you can see the signal. Who told you to use that fs, fc, and t_final?
To get values of -1 or +1 only, you can do
signal = 2 * randi([0, 1], 1, numElements) - 1;
2 comentarios
Image Analyst
el 9 de Dic. de 2020
You're welcome. Thanks for Accepting.
time() is a built-in function. Since you're not supposed to use built-in function names as variable names, I suggest you call it times instead of time.
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!