I tried using the 'Spectrum Analyzer' and those signal blocks (sine, pulse generator, triangle generator and sawtooth generator) separately of course, but the spectrum block needs a discrete signal or a non-infinite signal, and there's only a discrete sine block, is there a way to generate the others?
Most input blocks, including those you list, have a Sample Time parameter. Make it a number greater than 0 to specify a discrete sample time. For instance 0.001 would give you a milli-second sample rate.
For the few blocks that don't have this, simply use a Zero-Order Hold on the output of the block, and specify a sample time for the ZOH block.
Related
For example, I have a controller consisting of integrator and sine web signal combined in the input. My question may be very naive to you, please help me to understand.
In the picture I have a frequency which is the input of an integrator then two cos and sine block. How to make each Simulink block discrete using ZOH and rate transition block in Simulink.
Two potential solutions
Change the sample time of the sinewave to something that is non-zero. This will make it a discrete signal
Use a Zero Order Hold (as you've mentioned) to convert the signal to discrete, you will need to specify a sample time for this block to perform the conversion. Setting the time to 0.5 will sample the signal every half second for example.
I have to compute the cross-correlation between two transient signals with non-zero mean. I read that the function xcorr in MATLAB works properly only with zero-mean inputs.
Since these signals represent transient phenomena, it doesn't make sense to me to subtract the mean value.
My objective is to compute the time delay between the maximum values of the two signals. The signals are not exactly correlated-similar, but I guess this is always the case.
If i try to compute the time delay using xcorr, I get close results to what I expect (i.e the time delay checked visually by checking where the maximum of the two signals are) only using the UNBIASED options.
Why is that? Does the unbiased routine subtract the mean values from both my signals?
I want to be able to externally have inputs for the lower passband edge frequency and higher passband edge frequencies for the butterworth filter block in the simulink signal processing toolbox in matlab. How can I achieve this. Currently you'll have to click the block to specify these frequencies and this is not possible at runtime.
Regards,
Alfred
Basically you are asking for a filter that has time varying parameters. The Butterworth filter block does not allow for this, and cannot be modified to do so, so you are going to have to roll your own. This can be achieved in several ways:
Determining the difference equations that you need to implement, then creating a filter out of fundamental blocks (product, summation and unit delay blocks) where the "parameters" you want to change are fed into the product blocks as signals.
Using a block such as Transfer Fcn Direct Form II Time Varying. (This assumes you can parameterize the changes you need as a gain-scheduled signal.)
Write an S-Function (or perhaps a MATLAB Function block) to implement any detailed/specific functionality.
I am working in Simulink where I have the following problem.
I have a discrete state space model whose outputs are of course discrete. Outputs are corrupted (summed in the Simulink project) by a (continuous) sinusoidal disturbance.
Does there exist a block that takes as input a discrete signal and converts it to a continous signal?
Thanks in advance
You don't need to convert the discrete signal to continuous before adding it to a continuous signal.
If you use the Summation Block to add a discrete and a continuous time signal then the output (of the sum) will be continuous.
If for some other reason you need to do the conversion then look at the Rate Conversion Block.
I should stimulate how the lowpass filter work exactly with simulink so i create a signal generator f=50 hz and i make a lowerfilter and after that i want to see it so the only tool that i found it is spectrum analyzer but when i simulate i get two errors
Sorry if it's not really explain because i'm beginner in simulink
The signals being fed into the Spectrum Scope blocks need to be discrete-time signals instead of continuous-time. You can accomplish this by adding a Zero-Order Hold block before each Spectrum Scope, setting the desired discrete sample time in the Zero-Order Hold block's dialog parameters.
As a heads up, you're probably going to want to buffer your signals as well (the spectrum is calculated on "frames" of data, which you can read about here: Create Frame-Based Signals). To do this, you can either use a Buffer block in between your Zero-Order Hold and Spectrum Scope, or select "Buffer Input" in the Spectrum Scope dialog parameters.