I'm trying to get the output response of linear system represented by transfer function, once the white noise is given as an input. Here's the code:- For generating continuous noise, I'm getting help from the following question https://mathematica.stackexchange.com/a/158361/85034

  1. How to plot the output response?
  2. How to access the output values in one variable?
  3. How can I again apply ZOH (zero order hold) to sample this output?
  • $\begingroup$ Are you intending to work in the frequency domain or the time domain? In the frequency domain the spectrum of the output is the product of the spectrum of the transfer function and the spectrum of the noise. The difficulties here are the length of the spectrum and associated windowing problems. If you are working in the time domain then you can solve the differential equation for your transfer function (possibly very easily if linear) with a random excitation. In the time domain the issue is step size. Overall you have the issue of spectrum shape. White noise is never really white. $\endgroup$
    – Hugh
    Feb 11, 2022 at 8:56
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Feb 11, 2022 at 11:01

1 Answer 1

tmax = 10;
samplesPerSec = 0.25;
σ = 1;
tfm = TransferFunctionModel[(s + 1)/(s + 2), s];
noise = Interpolation[Normal[RandomFunction[WhiteNoiseProcess[σ], {0, tmax}]][[1]]];
out = OutputResponse[tfm, noise[t], {t, 0, tmax}];
Show[Plot[out, {t, 0, tmax}], ListStepPlot[Table[out[[1]], {t, 0, tmax, samplesPerSec}], 
  DataRange -> {0, tmax}, PlotStyle -> ColorData[97, 2]]]

enter image description here

  • $\begingroup$ Excellent @SubaThomas. Need help in passing output y(k) through G(z) to get output x(k), then to get Rxx(k). Only partial code is quoted: (Skipping the previous one due to limited space available) tfmd = TransferFunctionModel[(z^2 - 0.5 z + 0.05)/(0.5 z^2 + 0.1 z), z, SamplingPeriod -> samplesPerSec]; outputYk = Table[outputYt[[1]], {t, 0, tmax, samplesPerSec}]; outputXk = OutputResponse[tfmd, outputYk, {k, 0, kmax}]; ListPlot[CorrelationFunction[outputXk, {lags}], Filling -> Axis, PlotRange -> All] The output xk is zero, therefore unable to get Rxx. Anyone please guide... $\endgroup$ Feb 12, 2022 at 2:35
  • $\begingroup$ I assume outputYK is out in the question. And I don't know what is lags. Probably outputXk = OutputResponse[tfmd, outputYk] resolves your question. $\endgroup$ Feb 12, 2022 at 23:37
  • $\begingroup$ Initial code is as under: tmax = 10; kmax = 5; lags = 5; samplesPerSec = 0.5; [Sigma] = 1; tfm = TransferFunctionModel[2/(s + 1)/(s + 2), s]; noise = Interpolation[ Normal[RandomFunction[ WhiteNoiseProcess[[Sigma]], {0, tmax}]][[1]]]; outputYt = OutputResponse[tfm, noise[t], {t, 0, tmax}]; Show[Plot[outputYt, {t, 0, tmax}], ListStepPlot[Table[outputYt[[1]], {t, 0, tmax, samplesPerSec}], DataRange -> {0, tmax}, PlotStyle -> ColorData[97, 2]]] outputXk now seems to resolve the issue. However, unable to plot the correlation for any arbitrary value of lags. $\endgroup$ Feb 13, 2022 at 16:20
  • $\begingroup$ CorrelationFunction[outputXk[[1]], {lags}] $\endgroup$ Feb 13, 2022 at 23:32
  • 1
    $\begingroup$ Thanks a lot, @Suba Thomas. Indeed it is completely solved now. $\endgroup$ Feb 13, 2022 at 23:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.