How to generate a curve using matlab simulink - matlab

How to generate the curve of transfer function:
G0(s)=exp(-s)*[(2s+4)/(s^3+5s^2+6s+4)]
using MATLAB and Simulink?

What kind of curve do you mean? Bode plot? Nyquist plot? Step response?
Use the tf function to create your transfer function with the InputDelay parameter to represent the exp(-s), see Models with Time Delays in the documentation for more details.
Once you have your transfer function, you can use functions like bode, nyquist, step, impulse, etc... to generate your "curve" of choice.
All of this requires the Control System Toolbox.

Related

How do I turn a piecewise polynomial into a function in MATLAB?

I have been fitting some data generated in the lab. The best fit is by piecewise polynomial
I would now need to turn this into a function that I can then plug in a model (where I repeat this function with different time delays and then sum them up). What is the best way to do this? If I generate a fit wth the FIT function, I am then unable to use that object as a normal function. Any advice?

Drawing Nquvist-Plot i Simulink

I build an equivalent circuit in Simulink and it works. Now I want to get the nquvist plot of this equivalent circuit. Does anyone have an idea how to achieve this. Till now I only get the Impedance versus the frequency. I attached the equivalent circuit:
Thanks a lot
When using blocks from "Simscape Power Systems Specialized Technology" use voltage/current measurement blocks (depending on the numerator/denumerator of the transfer function). The outputs of these blocks are Simulink signals. Once you have the signals, you can use the "Simulink Control Design" toolbox to display a Nyquist plot directly. See following link for an example (although for Bode plot, but it is straight forward to apply the procedure to Nyquist plots).

Generating a sine wave in Simulink without any standard blocks

I'm trying to generate a sine wave without using any standard blocks available in Simulink. Right now I'm using constants for phase angle and frequency but eventually I want to vary this and hence not using the standard blocks. Here is the Simulink model
Here is the scope output
The output is not a sinusoidal wave. What am I screwing up here?
I'm using a fixed step auto solver.
As I'm currently not in the possession of Matlab/Simulink so I can't construct a working example. But I think the best solution for your problem is using a Simulink function block. In this block you can define a Matlab function of your own design and it will allow you to generate any signal you want.
Mathworks example

Designing a Matlab filter from a Laplace equation

I have a Laplace Transfer function that I wish to use in a high pass filter. I am trying to design a filter inside Matlab that will use this function using FDAtool but I don't understand how the parameters and coefficients this tool uses relates to the Laplace function I have.
Can anyone provide some information or links regarding the relationship between a function and the filter that uses it.
Why don't you simply use a Transfer Fcn block (or a Discrete Transfer Fcn block if it's discrete) since you already have the Laplace transfer function? FDAtool is for designing a filter as far as I know. It sounds like your filter is already designed.

Max-filter in matlab?

I like to find the envelope of an audio signal using matlab, i.e. the red signal in the picture. I have implemented a max-filter but the implementation is very slow. Does matlab have a built in max-filter or some other function that can calculate the envelope? (I have found a median filter but no max-filter)
There is no built-in max filter, but there are user generated functions at the MATLAB File Exchange. For example:
http://www.mathworks.com/matlabcentral/fileexchange/24902-envelope