Answered

Filter function in MATLAB

@Mohammad Zulqarnain, @Jan is right, as usual. I really like filtfilt() because it has zero phase lag at all frequencies. fil...

Filter function in MATLAB

@Mohammad Zulqarnain, @Jan is right, as usual. I really like filtfilt() because it has zero phase lag at all frequencies. fil...

5 days ago | 0

Answered

Help with my SIR MODEL

@Darren Tharby I think you did intend to call sirs_model(), from the File Exchange, since the seven variables which you pass ar...

Help with my SIR MODEL

@Darren Tharby I think you did intend to call sirs_model(), from the File Exchange, since the seven variables which you pass ar...

5 days ago | 0

Answered

Help with my SIR MODEL

@Darren Tharby, You get an error at lline 13 because line 13 (which is in function sir_model()) calls itself. That is not OK. ...

Help with my SIR MODEL

@Darren Tharby, You get an error at lline 13 because line 13 (which is in function sir_model()) calls itself. That is not OK. ...

5 days ago | 0

Answered

How to maintain tank water level in Matlab

@Anass Naoushy, The figures show simulaitons of responses to step changes in F1 and in F4. The attached code is for the seocnd...

How to maintain tank water level in Matlab

@Anass Naoushy, The figures show simulaitons of responses to step changes in F1 and in F4. The attached code is for the seocnd...

6 days ago | 0

Answered

Can anybody suggest me to draw a more meaningful histogram? Or how can I get the opposite histogram of this bar plot?

@Sk. Alam, I still do not understand what you want to do. You said you are plotting the histograms, and that you want to get ...

Can anybody suggest me to draw a more meaningful histogram? Or how can I get the opposite histogram of this bar plot?

@Sk. Alam, I still do not understand what you want to do. You said you are plotting the histograms, and that you want to get ...

7 days ago | 0

Answered

Can anybody suggest me to draw a more meaningful histogram? Or how can I get the opposite histogram of this bar plot?

@Sk. Alam, When I run your code I get the plot below. The triples of adjcent bars are hard to discern or appreciate. The x-xis...

Can anybody suggest me to draw a more meaningful histogram? Or how can I get the opposite histogram of this bar plot?

@Sk. Alam, When I run your code I get the plot below. The triples of adjcent bars are hard to discern or appreciate. The x-xis...

7 days ago | 0

| accepted

Answered

How to plot histogram of a given pdf

@Sudhir Sahoo, Here is a script that evaluates the density. Are there restrictions on what the allowed values are for m? You...

How to plot histogram of a given pdf

@Sudhir Sahoo, Here is a script that evaluates the density. Are there restrictions on what the allowed values are for m? You...

10 days ago | 0

| accepted

Answered

What is the reference magnitude/amplitude for calculating dB in the power colorbar using STFT?

@Jan Ali, The values plotted on the spectrogram are the power spectral density. The p.s.d. is a way of normalizing a power spe...

What is the reference magnitude/amplitude for calculating dB in the power colorbar using STFT?

@Jan Ali, The values plotted on the spectrogram are the power spectral density. The p.s.d. is a way of normalizing a power spe...

11 days ago | 2

| accepted

Answered

What is the reference magnitude/amplitude for calculating dB in the power colorbar using STFT?

The reference for the dB calculation is a signal whose rms amplitude and power are unity.

What is the reference magnitude/amplitude for calculating dB in the power colorbar using STFT?

The reference for the dB calculation is a signal whose rms amplitude and power are unity.

13 days ago | 1

Answered

How to code for this equation based on euler's, Huen's and 4th order Range Kutta method of ODE on MATLAB. Please Help.

@Anil Maddipatla, You're welcome. To plot all three solutions on one plot, I recommend that you name the solutions c1, c2, c3 ...

How to code for this equation based on euler's, Huen's and 4th order Range Kutta method of ODE on MATLAB. Please Help.

@Anil Maddipatla, You're welcome. To plot all three solutions on one plot, I recommend that you name the solutions c1, c2, c3 ...

14 days ago | 0

Answered

calculate distance with latitude and longitude

@ELISABETTA BILLOTTA I assume you know the standard formula for distance betwen two points whose longitudes () and latitudes ()...

calculate distance with latitude and longitude

@ELISABETTA BILLOTTA I assume you know the standard formula for distance betwen two points whose longitudes () and latitudes ()...

14 days ago | 0

| accepted

Answered

How to code for this equation based on euler's, Huen's and 4th order Range Kutta method of ODE on MATLAB. Please Help.

@Anil Maddipatla, What have you tried so far, and what errors do you get? The three methods you have cited are for solving a d...

How to code for this equation based on euler's, Huen's and 4th order Range Kutta method of ODE on MATLAB. Please Help.

@Anil Maddipatla, What have you tried so far, and what errors do you get? The three methods you have cited are for solving a d...

15 days ago | 0

| accepted

Answered

ode 45 doesnt work

@Naor t, It doesn;t work because you define y0=[-1 8], a vector with 2 elements. Therefore ode45() gets into trouble when it tr...

ode 45 doesnt work

@Naor t, It doesn;t work because you define y0=[-1 8], a vector with 2 elements. Therefore ode45() gets into trouble when it tr...

15 days ago | 1

| accepted

Answered

How can I write a custom complex mathematical expression?

@KUMAR TRIPATHY, I recommend that you read the Matlab help on writing functions. Here is an example of how you can create the ...

How can I write a custom complex mathematical expression?

@KUMAR TRIPATHY, I recommend that you read the Matlab help on writing functions. Here is an example of how you can create the ...

15 days ago | 0

Answered

How to make weighted random sampling for matrix

@Michele Pio Papasidero, Function x=weightedRandomSample(v,p), attached, does what you have requested. It returns a random samp...

How to make weighted random sampling for matrix

@Michele Pio Papasidero, Function x=weightedRandomSample(v,p), attached, does what you have requested. It returns a random samp...

15 days ago | 0

Answered

Curve Fitting an equation

@Arjun Siddharth, EI appears as a constant factor in the denominator of eq. 16 for . Therefore if you use a different value of ...

Curve Fitting an equation

@Arjun Siddharth, EI appears as a constant factor in the denominator of eq. 16 for . Therefore if you use a different value of ...

27 days ago | 0

| accepted

Answered

Error message odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

@Chris Li, Your function myode() returns 4 quantities: dydt, NA, NB, and Ff. function [dydt, NA, NB, Ff] = myode(t, y, n) I'm...

Error message odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);

@Chris Li, Your function myode() returns 4 quantities: dydt, NA, NB, and Ff. function [dydt, NA, NB, Ff] = myode(t, y, n) I'm...

28 days ago | 0

Answered

Probability vector from a Markov Transition Matrix

@Daniel Caballero, I used the code and ideas I posted in the earlier answer, with appropriate constants for your particular mode...

Probability vector from a Markov Transition Matrix

@Daniel Caballero, I used the code and ideas I posted in the earlier answer, with appropriate constants for your particular mode...

29 days ago | 0

| accepted

Answered

Wind rose - collateral points, continuous circle at 50% and the percentages on a line (west to center)

@Jacqueline Rigatto, That's 400 lines of code! Check out https://www.mathworks.com/matlabcentral/fileexchange/47248-wind-rose ...

Wind rose - collateral points, continuous circle at 50% and the percentages on a line (west to center)

@Jacqueline Rigatto, That's 400 lines of code! Check out https://www.mathworks.com/matlabcentral/fileexchange/47248-wind-rose ...

1 month ago | 0

Answered

Finding a parameters of nonlinear equations

@Adel Khaled, I would do this analytically, at least for a while. SOme of your posting was cut off on th left edge, but here's ...

Finding a parameters of nonlinear equations

@Adel Khaled, I would do this analytically, at least for a while. SOme of your posting was cut off on th left edge, but here's ...

1 month ago | 0

Answered

ode23, ode45 acting weird - why?

@David Goodmanson, Thank you for your thoughts and for running the code. I am glad to know that you got similar results. As fo...

ode23, ode45 acting weird - why?

@David Goodmanson, Thank you for your thoughts and for running the code. I am glad to know that you got similar results. As fo...

1 month ago | 0

Answered

Data fitting with custom equation

@Somnath Kale, fmincon() is a very good general purpose routine to find the parameters that give a good fit to your data. Read...

Data fitting with custom equation

@Somnath Kale, fmincon() is a very good general purpose routine to find the parameters that give a good fit to your data. Read...

1 month ago | 0

| accepted

Answered

2nd order differential errors

@John Masters, Are you getting an error message? If so, what? I notice that your dydt is mising a "*" after C.

2nd order differential errors

@John Masters, Are you getting an error message? If so, what? I notice that your dydt is mising a "*" after C.

1 month ago | 0

Answered

Step Function for Checking if Point is inside Spherocylinder

@Mari Teli, I do not understand what spherocylinder() is supposed to do, because your question does not seem to match the output...

Step Function for Checking if Point is inside Spherocylinder

@Mari Teli, I do not understand what spherocylinder() is supposed to do, because your question does not seem to match the output...

1 month ago | 0

Answered

set extrapolation to connect last point values to the first (extrapolated) ones with interp1

@gabriele fadanelli, Since you know your function is periodic with period 365, add a new last point to x() and to y(). The new ...

set extrapolation to connect last point values to the first (extrapolated) ones with interp1

@gabriele fadanelli, Since you know your function is periodic with period 365, add a new last point to x() and to y(). The new ...

1 month ago | 0

Answered

Factorial(1000) as number

@Khannanov Shamil, You want to calculate n! ~ sqrt(2*pi*n) * (n/e)^n (Stirling's approximation) but it is too big when n>170...

Factorial(1000) as number

@Khannanov Shamil, You want to calculate n! ~ sqrt(2*pi*n) * (n/e)^n (Stirling's approximation) but it is too big when n>170...

1 month ago | 1

Answered

Factorial(1000) as number

@Khannanov Shamil, I agree with the suggesiton to use Sritlin's approximation and just report the log of the factorial: where...

Factorial(1000) as number

@Khannanov Shamil, I agree with the suggesiton to use Sritlin's approximation and just report the log of the factorial: where...

1 month ago | 0

Question

ode23, ode45 acting weird - why?

I am integrating a pair of simple non-stiff first order differential equations. The output, using ode45(), is as expected, when...

1 month ago | 2 answers | 0

Answered

Error using odearguments (line 113) Inputs must be floats, namely single or double.

@Quanshun An, I recommend that you remove the syms command at the top of your code. You have defined a bunch of constants in t...

Error using odearguments (line 113) Inputs must be floats, namely single or double.

@Quanshun An, I recommend that you remove the syms command at the top of your code. You have defined a bunch of constants in t...

1 month ago | 0

Answered

use fitdist() to fit normal distribution with GIVEN MEANS.

@gabriele fadanelli, If the mean is known in advance, then the maximum likelihood estimator for is which is easy to calcul...

use fitdist() to fit normal distribution with GIVEN MEANS.

@gabriele fadanelli, If the mean is known in advance, then the maximum likelihood estimator for is which is easy to calcul...

1 month ago | 1

| accepted