Answered
Graphing Fourier magnitude and phase spectra using fft, error: Array indices must be positive integers or logical values.
Hi Luke, At the line in question, we see that x(t) is non-integer numeric value, which can't be used to index into the array ff...

3 years ago | 0

Answered
matrix math problems , error in matrix size
Hard to say without without knowing anything about the data in the question. Based on the wording it should work as follows A =...

3 years ago | 0

| accepted

Answered
Creating a Closed loop transfer function of a model
Hi Jacob, Perhaps a clue is that the code doesn't use loop1 after it's computed. Once you have loop1, how does it relate to G2 ...

3 years ago | 0

| accepted

Answered
How to solve a non-linear system of differential equations?
Hi Pacao, The missing step is a call to odeToVectorField before the call to matlabFunction. Check that first doc page and then ...

3 years ago | 0

Answered
Systems with two different execution rates
Hi Samy, Are you intending to have one model reference the other via a Model block? If so, and if you have at least R2022a, I ...

3 years ago | 1

Answered
Calling the vectorized Matlab fcn from within Simulink
Use a Matlab Function block in the Simulink model and call your function from inside that block. If your function is not amenabl...

3 years ago | 0

| accepted

Answered
Generating numbers following a lognormal distribution within a specific interval
Hi Behrooz, Shouldn't the relationship be the log of the mean of samples is equal to mu + sigma^2/2 ? In any case, why would t...

3 years ago | 0

Answered
Inconsistency of the figure and value on the curve
Hi @M The equation for Dcdenominator is not properly vectorized. In one spot it uses /, which should be ./ % was % Dcdenom...

3 years ago | 0

| accepted

Answered
Problem using symbolic sinc?
We can get rid of the vertical asymptote with: syms x y w F A = 1; tau = 1; F = A*tau*sinc(w/(2*pi)*tau); figure fplot(abs...

3 years ago | 0

| accepted

Answered
Mixture of 2 salts + Dirac
Hi Adrielli, Why is Ain defined and then redefined? Is that correct? What is the role of the x and y variables in this problem...

3 years ago | 1

| accepted

Answered
How to create a transfer function with no simplification ?
I'm almost certain that this can't be done in the CST. If just wanted for display purposes you'd have to write your own code, bu...

3 years ago | 1

Answered
Discrete input signal and continuous transfer function
Not sure what the issue was with lsim without seeing the code. Is the transfer function contiuous time, e.g. a model of an anal...

3 years ago | 0

Answered
how to replace a symbolic variable with a real one after computation?
Use subs or symfun objects and covert to double are two options syms I3 I4 d = I3 + I4; double(subs(d,[I3 I4],[1.1 2.2])) d(...

3 years ago | 0

| accepted

Answered
sinc function doesnt work...
The code runs fine here. clear all close all clc T=0.1; A=1; tau=T/2; kmax=20; t0=tau/2; %% f0=1/T; t=(0:0.0001:1)*5*...

3 years ago | 0

Answered
Find source of stopped simulation in Simulink
Hi Stefan, If you use the sim command, then the output has some useful information. For example, I used a model with a Clock, f...

3 years ago | 0

| accepted

Answered
Bode Plot options to graph
Can be done if using bodeplot instead of bode H = tf([1 0.1 7.5],[1 0.12 9 0 0]); h = bodeplot(H); setoptions(h,'MagUnits','a...

3 years ago | 0

Answered
How to skip many vectors in a legend?
Something like this, but with different data simulation = rand(100,20); average = mean(simulation,2); analytical = 0*average+...

3 years ago | 1

| accepted

Answered
3D plot of sum series, error in symsum fuction
Hi grisham, The function symsum can only be used with symbolic inputs, as created by syms for example. However, the code has no...

3 years ago | 0

Answered
How to you put sin function in Simulink
Feed the output of a Clock into a Gain of 1/2. Feed the touput of that gain into a Trigonmetric Function block, select the cos o...

3 years ago | 0

| accepted

Answered
in the histogram function using "Normalization", "cdf" to draw out the histogram and cdf does not match, the end of histogram doesn't reach "1"
Are there any NaNs (or something similar) in uk.icu_patients? It seems that histogram and cdfplot treat NaNs differently x = r...

3 years ago | 1

| accepted

Answered
Phase gradient in fft
Hi Jiayun, First of all, I don't see anything in the code that does "zero-padding." That term typically refers to augmenting a ...

3 years ago | 0

| accepted

Answered
gfdeconv implementation in Simulink
If gfdeconv is not supported for code generation (it appears not to be as there is no "Extended Capabiliites" section on its doc...

3 years ago | 1

Answered
What is the reason why Simulink does not display numbers when I enter decimals for block parametric values?
Click/hold on a corner of the block and stretch it until the numerator and denominator polynomials are displayed.

3 years ago | 0

Answered
Question about eigen-vector compute value
"I need to compute the eigevector belonging to the maximum eigen value." Why is SVD being used? Just use eig? o=eye(3); z=zer...

3 years ago | 0

Answered
Turn cell array including space (i.e, ' ') into string
cell_arr = [{'c'} {'a'} {'s'} {'t'} {' '} {'m'} {'e'} {'m'} {'b'} {'e'} {'r'} {'s'}]; If a sti...

3 years ago | 1

| accepted

Answered
How to operate block matrices?
One can always store block matrices in cell arrays and then roll code to implement the block matrix algebra. Maybe there is a su...

3 years ago | 1

Answered
How to plot shaded rectangles?
One option is rectangle. Can make the color whatever you want, but not transparent t = 0:.01:1; plot(t,sin(10*t)) grid r = r...

3 years ago | 2

| accepted

Answered
Using conv() function
h, x, and u are actually functions that are evaluated at the values of their input arguments. So need to evaluate h and x at the...

3 years ago | 0

Answered
string to array and then getting the first value of the array
It's just solid(1)

3 years ago | 0

| accepted

Answered
Linear equations with three unknowns
Hi Ahmed, The problem in the Question is ill-defined becasue there are no values of (x,y,z) that satisfy all four equations. ...

3 years ago | 0

Load more