Design an Input Signal
古いコメントを表示
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 件)
カテゴリ
ヘルプ センター および File Exchange で MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!