フィルターのクリア

How to convert idinput signal to analog signal

8 ビュー (過去 30 日間)
Rohan Gulur
Rohan Gulur 2023 年 8 月 4 日
コメント済み: Star Strider 2023 年 8 月 7 日
Hello,
I am trying to work on a signal processing project to convert an idinput binary signal to an analog signal.
For example, suppose I have specified the following code to generate the idinput signal:
Range = [0,1];
Band = [0 1];
u1 = idinput([100,1,1],'prbs',Band,Range);
How can I, for example, take this digital binary signal and convert it into an analog signal so I can use it in in a system response with a transfer function thru lsim.
For example:
sys = tf([8 18 32],[1 6 14 24]);
t = 0:0.01:4;
u = (this is the converted digital binary signal(u1)->analog signal)
outputResposne=lsim(sys,u,t)
Essentially, I am trying to take a PRBS (0,1) input signal, convert it to an analog signal, apply a transfer function on it, and measure the output signal(first as an analog signal), and then convert the analog output response signal back to digital
If there are better ways to supply a PRBS input signal and convert it to analog please let me know.
Any help is greatly appreciated.
Thanks.

採用された回答

Star Strider
Star Strider 2023 年 8 月 4 日
編集済み: Star Strider 2023 年 8 月 4 日
As I understand lsim, it automatically samples continuous time models using the defined method (or the method it decides to use, based on the model). So nothing is specifically required for continuous-time models, since lsim figures out on its own how best to discretise the model. Just assume the idinput signal is continuous, run it with lsim, and see what the result is.
EDIT — (4 Aug 2023 at 18:10)
With a few tweaks to the original code, it works —
Range = [0,1];
Band = [0 1];
u1 = idinput([401,1,1],'prbs',Band,Range);
Warning: The PRBS signal delivered is the 401 first values of a full sequence of length 511.
sys = tf([8 18 32],[1 6 14 24])
sys = 8 s^2 + 18 s + 32 ----------------------- s^3 + 6 s^2 + 14 s + 24 Continuous-time transfer function.
figure
bode(sys)
grid
figure
step(sys)
grid
t = 0:0.01:4;
u = u1;
outputResponse=lsim(sys,u,t);
figure
plot(t,outputResponse, '-')
hold on
plot(t,u, '--')
hold off
grid
xlabel('Time (s)')
ylabel('Amplitude')
.
  2 件のコメント
Rohan Gulur
Rohan Gulur 2023 年 8 月 7 日
Hello Star Strider,
I do have a slightly different response as my output signal is discontinuous for some reason. My transfer function is of the form sys = tf([-variable*variable*variable*variable, -variable*variable],[variable*variable, 1+(variable*variable/2)]); It looks similar in shape to the input signal, albeit with the peak amplitude being different.
Star Strider
Star Strider 2023 年 8 月 7 日
O.K.
I don’t understand the reason for the output being discontinuous unless the system produces non-finite values that MATLAB is unable to plot. (I used the system you provided, so I cannot determine what your actual system is doing.)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDynamic System Models についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by