Answered

How can I count how many times the position of a bouncing ball on the simulator hits 0?

Drag a Triggered Subsystem into the diagram. Connect the output of the <=0 block to the trigger input of the Triggered Subsyste...

How can I count how many times the position of a bouncing ball on the simulator hits 0?

Drag a Triggered Subsystem into the diagram. Connect the output of the <=0 block to the trigger input of the Triggered Subsyste...

18 days ago | 0

Answered

simulink-function block

This line (and others like it) doesn't do what you think it does: 68.832 < u <= 200 Consider: u = 203; 68.832 < u <= 200 Th...

simulink-function block

This line (and others like it) doesn't do what you think it does: 68.832 < u <= 200 Consider: u = 203; 68.832 < u <= 200 Th...

18 days ago | 0

| accepted

Answered

rearrange an equation in simulink

I'm not necessarily recommending this, but since you asked you can try an Algegbraic Constraint block.

rearrange an equation in simulink

I'm not necessarily recommending this, but since you asked you can try an Algegbraic Constraint block.

19 days ago | 2

Answered

Is there a block in Simulink to load equations in state variables ?

This one? State Space

Is there a block in Simulink to load equations in state variables ?

This one? State Space

19 days ago | 0

Answered

Recurrence Relation having undefined variables

Do you get the desired result if you move the line syms lamda c0 c1 to inside the function? Also it's kind of confusing to ha...

Recurrence Relation having undefined variables

Do you get the desired result if you move the line syms lamda c0 c1 to inside the function? Also it's kind of confusing to ha...

20 days ago | 0

| accepted

Answered

Simulink block to get the specified value

One option to grab the value of a signal at a certain time and hold it afterwards is to pass it through a Triggered Subsystem, w...

Simulink block to get the specified value

One option to grab the value of a signal at a certain time and hold it afterwards is to pass it through a Triggered Subsystem, w...

20 days ago | 0

Answered

Why do i get error while converting Block diagram to transfer function?

The problem is with this line: [a, b, c, d] = ss2tf(connect(G1,G2,G3,sum1,sum2,sum3,'r','y')) ss2tf only computes 2 outputs, b...

Why do i get error while converting Block diagram to transfer function?

The problem is with this line: [a, b, c, d] = ss2tf(connect(G1,G2,G3,sum1,sum2,sum3,'r','y')) ss2tf only computes 2 outputs, b...

20 days ago | 1

| accepted

Answered

I am trying to solve 3 simultaneous ODE's. Which method to use?

This line: dy = zeros(4,1); Needs to be replaced with: dy = zeros(3,1); After that, note that the equation for dy(1) evaluat...

I am trying to solve 3 simultaneous ODE's. Which method to use?

This line: dy = zeros(4,1); Needs to be replaced with: dy = zeros(3,1); After that, note that the equation for dy(1) evaluat...

21 days ago | 1

| accepted

Answered

Step response error when using step

An improper transfer function has a numerator with higher order than the denominator. In your case, the numerator is second ord...

Step response error when using step

An improper transfer function has a numerator with higher order than the denominator. In your case, the numerator is second ord...

21 days ago | 0

Answered

From numerical FFT to zero-pole diagram

Poles and zeros are based on the transfer function, which relates the output to the input. So in addition to the output signal, ...

From numerical FFT to zero-pole diagram

Poles and zeros are based on the transfer function, which relates the output to the input. So in addition to the output signal, ...

21 days ago | 0

Answered

how to concat two strings with data from external file inbetween?

One approach, I'm sure there are others: first = "Simpson"; last = "Wilder"; nums = string(readmatrix('input.txt')); out = ...

how to concat two strings with data from external file inbetween?

One approach, I'm sure there are others: first = "Simpson"; last = "Wilder"; nums = string(readmatrix('input.txt')); out = ...

22 days ago | 0

Answered

How to fit a gaussian to unnormalized data

I think you need to normalize Y by it's sum (given the unit spacing of X), not its max X = -6:1:6; Y = [1 3 1 8 5 16 18 10 6 2...

How to fit a gaussian to unnormalized data

I think you need to normalize Y by it's sum (given the unit spacing of X), not its max X = -6:1:6; Y = [1 3 1 8 5 16 18 10 6 2...

23 days ago | 1

| accepted

Answered

Knowing the closed form solution of dx/dt = 2 sin 3t − 4x, how do I construct my Simulink?

So you need to express -cos(3*t + atan(4/3)) as the sum of two sine waves. If you're allowed to make the amplitude of one of ...

Knowing the closed form solution of dx/dt = 2 sin 3t − 4x, how do I construct my Simulink?

So you need to express -cos(3*t + atan(4/3)) as the sum of two sine waves. If you're allowed to make the amplitude of one of ...

23 days ago | 1

| accepted

Answered

Advices on realizing a decreasing pulsing function with Simulink.

It sounds like what you want is the input, u, to be the cumulative ON-time, and the output, m_dot, should be zero when the drivi...

Advices on realizing a decreasing pulsing function with Simulink.

It sounds like what you want is the input, u, to be the cumulative ON-time, and the output, m_dot, should be zero when the drivi...

23 days ago | 1

| accepted

Answered

Matrix slicing in matlab

Use mat2cell x = rand(4,2); % the matrix c = mat2cell(x,[2 2],2); % the cell array % verify c{1} - x(1:2,:) c{2} - x(3:4,:)...

Matrix slicing in matlab

Use mat2cell x = rand(4,2); % the matrix c = mat2cell(x,[2 2],2); % the cell array % verify c{1} - x(1:2,:) c{2} - x(3:4,:)...

23 days ago | 0

Answered

Unable to set gain control as a variable in Simulink, setting a numeric value works OK.

It turns red with the exclamation mark because you haven't defined the variable in any workspace that the model can see (typical...

Unable to set gain control as a variable in Simulink, setting a numeric value works OK.

It turns red with the exclamation mark because you haven't defined the variable in any workspace that the model can see (typical...

25 days ago | 0

Question

Sym Matrices can be Indexed with non-Logical/non-Integer. Bug?

Linear indexing into a sym array: A = sym([1 2;3 4]) A(.5) A(1.1) A([1.2 2.2]) But element indexing produces an error A(1...

26 days ago | 0 answers | 1

Answered

What Happened to the SrcWorkspace Name-Value Input to the sim() Command?

Looks like one has to use a Simulink.SimulationInput object as the input to the sim() command.

What Happened to the SrcWorkspace Name-Value Input to the sim() Command?

Looks like one has to use a Simulink.SimulationInput object as the input to the sim() command.

26 days ago | 0

Answered

How update some variables each time tha I'am calling simulink from Matlab funtion

Try using a Simulink.SimulationInput object. Change the code to: function [Out] = Funtion (Var1, Var2 ....) in ...

How update some variables each time tha I'am calling simulink from Matlab funtion

Try using a Simulink.SimulationInput object. Change the code to: function [Out] = Funtion (Var1, Var2 ....) in ...

26 days ago | 0

Question

What Happened to the SrcWorkspace Name-Value Input to the sim() Command?

The SrcWorkspace Name-Value pair argument to the sim() command seems to have disappeared going from 2020b to 2021a. I searched ...

27 days ago | 1 answer | 0

Answered

How to get generalized plant model in state space (A,B1,B2,C1,D11,D12,C2,D21,D22) using augw command?

Does this Answer help?

How to get generalized plant model in state space (A,B1,B2,C1,D11,D12,C2,D21,D22) using augw command?

Does this Answer help?

28 days ago | 0

Answered

Problem when graphing digital filter chebyshev

Need some some addition arguments to freqz(). Check its doc page for more information: Fs = 44000; Fn = Fs/2; ...

Problem when graphing digital filter chebyshev

Need some some addition arguments to freqz(). Check its doc page for more information: Fs = 44000; Fn = Fs/2; ...

28 days ago | 1

Answered

Request for help computing convolution of random variables via fft

Here is one option, illustrated with two widely separated normal pdfs: mu1 = 10; sigma1 = 2; mu2 = -5; sigma2 = 1; Zextreme =...

Request for help computing convolution of random variables via fft

Here is one option, illustrated with two widely separated normal pdfs: mu1 = 10; sigma1 = 2; mu2 = -5; sigma2 = 1; Zextreme =...

30 days ago | 0

Question

Should the Symbolic Math Toolbox Enforce Assumptions on Assignment?

Consider the following: syms a real isAlways(in(a,'real')) So far, so good. But a = sym(2)*1i; % accepted w/o error or war...

1 month ago | 2 answers | 0

Answered

Conditional Normal Random Distribution

Yes. If you know mu and Sigma of the vector x and the first n values of x are given, then the density of x(n+1:end) is also nor...

Conditional Normal Random Distribution

Yes. If you know mu and Sigma of the vector x and the first n values of x are given, then the density of x(n+1:end) is also nor...

1 month ago | 0

| accepted

Answered

CDF of VOn Mises distribution

This code seems to recreate one of the CDF plots on the linked wikipedia page. It doesn't run very fast. syms x mu kappa x0 rea...

CDF of VOn Mises distribution

This code seems to recreate one of the CDF plots on the linked wikipedia page. It doesn't run very fast. syms x mu kappa x0 rea...

1 month ago | 0

Answered

I have a symbolic expression from simplify which has obvious cancellations and other further simplifications: how do I force this?

Sometimes you can get furhter along by putting assumptions on the variables that reflect what they actually represent. For examp...

I have a symbolic expression from simplify which has obvious cancellations and other further simplifications: how do I force this?

Sometimes you can get furhter along by putting assumptions on the variables that reflect what they actually represent. For examp...

1 month ago | 0

Answered

blkbuild command is not functioning in my matlab software, i have installed control system toolbox although programme is not executing.

Hmm. Not sure why that error is coming up. Block 1 is clearly defined. But Block 3 is not, so that should cause an error. Did ...

blkbuild command is not functioning in my matlab software, i have installed control system toolbox although programme is not executing.

Hmm. Not sure why that error is coming up. Block 1 is clearly defined. But Block 3 is not, so that should cause an error. Did ...

1 month ago | 0

Answered

The modeling of delta function in the numerical calculations

Would it just be: deltafunc = @(t,tprime,deltat)((abs(t-tprime)<deltat/2)./deltat); % assumes deltat > 0 Not sure how that Xz ...

The modeling of delta function in the numerical calculations

Would it just be: deltafunc = @(t,tprime,deltat)((abs(t-tprime)<deltat/2)./deltat); % assumes deltat > 0 Not sure how that Xz ...

1 month ago | 0

Answered

find overshoot, undershoot, rise time and fall time on a non step response function

I'm not sure what you mean by "fall time," so can't help you there. Why isn't stepinfo(y,t) sufficient? Is the data too nois...

find overshoot, undershoot, rise time and fall time on a non step response function

I'm not sure what you mean by "fall time," so can't help you there. Why isn't stepinfo(y,t) sufficient? Is the data too nois...

1 month ago | 0