Answered
lsim() vs step() : are different responses expected?
The code and the system in the .mat file does not recreate the step plot. There is also an undefined variable. load sys.mat % ...

3 years ago | 0

Answered
What is being "averaged" in the matlab bandpower() function?
Hi Joey, I will confess to only having basic knowledge of this subject and suggest a thorough review of a good textbook. I'll t...

3 years ago | 0

Answered
change class syms to double
Something like this ... e = exp(sym(1)) class(e) format long e = double(e) class(e)

3 years ago | 0

Answered
ifft returns NaN when plotting the impulse response function
Hi 粤轩 杨, It looks like h_FFT also has a few values that are inf, in addition to the NaNs load("AIF_1.mat"); load("inj_1.mat")...

3 years ago | 0

| accepted

Answered
Extract first and last row of each subarray in a cell array
I think this works even if the first and last row of a cell are identical. load(websave('cellArray.mat','https://www.mathworks....

3 years ago | 1

| accepted

Answered
Issues with subs function
I'm sure if you go through it step-by-step, or w/o assigning numbers until the end, you'll see that value of b1 is magical and a...

3 years ago | 0

| accepted

Answered
plotting a surface between two curve
Hi M, Here's some code to get started. % small curve file_address = 'https://www.mathworks.com/matlabcentral/answers/uploaded...

3 years ago | 0

| accepted

Answered
convolution without conv function
Questions like this are fairly common on this forum. A closed form expression can be obtained using syms heaviside rectangula...

3 years ago | 0

Answered
fplot and laplace transform
Based on the comment thread in the question, I think the best you can do symbolically would be some something like this: A = [-...

3 years ago | 1

Answered
Complex equation in MATLAB (control engineering)
Hi Michael, vpasolve found a solution, even if it's not the one you want. syms s syms w T real F_O = (exp(-s*T))/(s*(1+s)); ...

3 years ago | 0

Answered
how to model this algorithm in simulink?
In the integrator block, set the "Initial Condition Source" to external. Then, connect that source to whatever logic you need t...

3 years ago | 0

Answered
Discretize State Space feedback controller using c2d()
Hi John, lqrd returns the gains for a discrete time controller. The Control System Toolbox cannot model hybrid systems, as far ...

3 years ago | 1

| accepted

Answered
Matlab function block and integration
If computing the instantaneous power as a function of time, why not feed that into an integerator to find the energy as a functi...

3 years ago | 1

Answered
How to create a sine function from simulink blocks?
Why not just use a Sine Wave block? Would be a lot easier, and you can specify the sample time. The plot you're getting is most...

3 years ago | 0

| accepted

Answered
Linearize and Transfer Function
Does linearize do what you need? It can be used to linearize a model or a specific block in a model. Not sure how well it works...

3 years ago | 1

Answered
remove annotations from diskmarginplot
Hi Muhammad, Something like this might work, either inside or after the loop. Some experimentation may be needed. Disk margin ...

3 years ago | 0

| accepted

Answered
How do I change variables so that I can differentiate with respect to a derivative?
Hi Curran, The doc page functionalDerivative has related example and shows the problem can be solved like this: % Symbols sy...

3 years ago | 2

| accepted

Answered
Normalizing an FFT Vector
Hi bil, Define psi syms x real L = 100; psi(x) = sqrt(sym(2)/L)*sin(sym(pi)*x/L)*rectangularPulse(0,L,x); %particle in a box...

3 years ago | 1

| accepted

Answered
Close loop bode plot
If you have a model of the plant and a model of the controller, it's likely that all that's needed is the feedback command to co...

3 years ago | 0

Answered
How does bandpower() round the input frequencies in variable 'freqrange'?
Hi Joey, bandpower is an .m file, at least in 2022a, so you can inspect the code. My reading is that it will compute the power...

3 years ago | 0

| accepted

Answered
Symbolic acos( cos(theta) ) does not return theta.
simplify does provide an option that returns theta: syms theta real assume( theta >-1 & theta < 1) a = simplify( acos(cos(the...

3 years ago | 0

Answered
I have a transfer function as shown, how do i introduce this block in simulink
Use a Tranport Delay block with Time Delay parameter of 0.2 in series with a Transfer Fcn with Numerator 1 and Denominator [0.1 ...

3 years ago | 0

Answered
I cannot match the calculated from formula FFT with the MATLAB answer though they should be the same
Hi Jonathan Let's define the input signal symbolically clear syms a x w real s1(x) = a*sech(a/sqrt(2)*x) Its Continous Time...

3 years ago | 1

| accepted

Answered
d2c adding additional states to LTI
Hi Bobby, d2c using either the zoh or foh methods has a constraint that the eigenvalues of the A matrix can't be on the negativ...

3 years ago | 0

| accepted

Answered
Using rlocus I am confused
Hi Madyson, If you want to draw the root locus for a specific range of gains, then only specify a single range at a time G = t...

3 years ago | 0

Answered
How can I get the parameters of a MATLAB Function programmatically on command line
For a specific Matlab Function block, as asked in the question (I have a simple Matlab Function block in my model with one input...

3 years ago | 0

Answered
Simulink State Space Error
Hi Dylan, Unclear why the error message refers to "Project1/Step" when the model apparently does not contain a Step block. Any...

3 years ago | 1

| accepted

Answered
IMU sensor fusion: imufilter command reduces number of samples
Hi Aishwarya, Because the decimation factor is 2, shoudn't it be expected that there be half as many output samples as there ar...

3 years ago | 0

Answered
Using a persistent array in a Simulink function block
Hi richard, The typical structure would look like this: function [a11, a12, a21, a22, b1, b2] = fcn(I_in, V_out, U_in) persis...

3 years ago | 0

| accepted

Answered
simple test for nufft not working
Hi Pieter, I don't think that expression for Y(k) is correct. We can check symbolically %% define signal t = sym([-1.0,1.0]);...

3 years ago | 0

| accepted

Load more