Answered

How to impulse response including unit step function

Another approach is to use the impulse() from control system toolbox s = tf('s'); sys = 3/(s+2)-1/(s+1); % laplace transform o...

How to impulse response including unit step function

Another approach is to use the impulse() from control system toolbox s = tf('s'); sys = 3/(s+2)-1/(s+1); % laplace transform o...

environ une heure ago | 0

Answered

undefined function or variable 'sigshift'

As mentioned in Walter's answer here: https://www.mathworks.com/matlabcentral/answers/268957-undefined-function-or-variable-sigs...

undefined function or variable 'sigshift'

As mentioned in Walter's answer here: https://www.mathworks.com/matlabcentral/answers/268957-undefined-function-or-variable-sigs...

environ une heure ago | 0

Answered

Plotting magnitude of frequency response of the system

freqz only works for a discrete-time system. Your system is a continuous time. You will need to use freqresp as you did in your ...

Plotting magnitude of frequency response of the system

freqz only works for a discrete-time system. Your system is a continuous time. You will need to use freqresp as you did in your ...

environ une heure ago | 0

Answered

Best way to resample the output of a Simulink simulation with variable time step into a signal with a fixed sample time

No, resample() samples the signal at vector specified by simOut.POW.Time. So, in this case, it is not doing anything. I suggest ...

Best way to resample the output of a Simulink simulation with variable time step into a signal with a fixed sample time

No, resample() samples the signal at vector specified by simOut.POW.Time. So, in this case, it is not doing anything. I suggest ...

environ 12 heures ago | 1

Answered

2D plot of a function with two variables but one of the variables is set to assume precise values

See this example x = linspace(1, 20); y = [1,2,3,4,5]; figure(); ax = axes(); hold(ax); for i = 1:numel(y) z = x + ...

2D plot of a function with two variables but one of the variables is set to assume precise values

See this example x = linspace(1, 20); y = [1,2,3,4,5]; figure(); ax = axes(); hold(ax); for i = 1:numel(y) z = x + ...

environ 12 heures ago | 0

Answered

Calling a function within an fmincon slows it down?

I think it is probably being loaded at each iteration. MATLAB JIT compiler will not be able to optimize this part since it canno...

Calling a function within an fmincon slows it down?

I think it is probably being loaded at each iteration. MATLAB JIT compiler will not be able to optimize this part since it canno...

environ 12 heures ago | 0

Answered

Issues with Breaking while loop in Appdesigner.

Try the method in the attached app.

Issues with Breaking while loop in Appdesigner.

Try the method in the attached app.

environ 12 heures ago | 0

Answered

how to convert signal into 2D image gray scale

The documentation shows that if you call cwt(): https://www.mathworks.com/help/wavelet/ref/cwt.html with an output argument, the...

how to convert signal into 2D image gray scale

The documentation shows that if you call cwt(): https://www.mathworks.com/help/wavelet/ref/cwt.html with an output argument, the...

environ 13 heures ago | 0

Answered

Need to erease all the rows of a matrix where a zero appears

idx = any(A==0, 2); A(idx, :) = []

Need to erease all the rows of a matrix where a zero appears

idx = any(A==0, 2); A(idx, :) = []

environ 13 heures ago | 0

Answered

How to index a value of an anonymous function

The exact solution depends on what are the input arguments of dydt, but if it is defined as an anonymous function, then you shou...

How to index a value of an anonymous function

The exact solution depends on what are the input arguments of dydt, but if it is defined as an anonymous function, then you shou...

environ 13 heures ago | 0

| accepted

Answered

How to do different scaling in x in maltab plot (multiple scales in X axis)?

There is no built-in command to do such a thing in MATLAB. One of the workarounds is to create multiple axes objects and connect...

How to do different scaling in x in maltab plot (multiple scales in X axis)?

There is no built-in command to do such a thing in MATLAB. One of the workarounds is to create multiple axes objects and connect...

environ 13 heures ago | 0

Answered

How to generate an array of poisson distributed (without any built-in function) 0 and 1 of a known lambda value?

Read about inverse transform sampling() https://en.wikipedia.org/wiki/Inverse_transform_sampling . You will at least need to use...

How to generate an array of poisson distributed (without any built-in function) 0 and 1 of a known lambda value?

Read about inverse transform sampling() https://en.wikipedia.org/wiki/Inverse_transform_sampling . You will at least need to use...

environ 13 heures ago | 0

Answered

Given the function of a line (linear), how can I get the number of occurrences that given points land above or below that line?

The method you described seems to be very inefficient and overkill to solve a very simple problem. Suppose you have a point (x1,...

Given the function of a line (linear), how can I get the number of occurrences that given points land above or below that line?

The method you described seems to be very inefficient and overkill to solve a very simple problem. Suppose you have a point (x1,...

environ 13 heures ago | 0

| accepted

Answered

Using functions from R2020b in R2019a

No, MATLAB functions introduced in a later release cannot be used in an older release. There may be several other dependencies, ...

Using functions from R2020b in R2019a

No, MATLAB functions introduced in a later release cannot be used in an older release. There may be several other dependencies, ...

environ 13 heures ago | 0

Answered

Plotting the exp(-x) using the power series expansion and for loop

The series expansion is wrong. Check the following code x1 = 0:0.1:5; y = exp(-x1); figure plot(x1,y,'k') % plots the true f...

Plotting the exp(-x) using the power series expansion and for loop

The series expansion is wrong. Check the following code x1 = 0:0.1:5; y = exp(-x1); figure plot(x1,y,'k') % plots the true f...

environ 14 heures ago | 1

| accepted

Answered

Convert vector of characters to doubles/numeric

Is it available as a cell array. If yes, then try this x = { '1.0118' '1.0075' '1.0064' '1.0077' '1.0087' '1.0213' '1.02...

Convert vector of characters to doubles/numeric

Is it available as a cell array. If yes, then try this x = { '1.0118' '1.0075' '1.0064' '1.0077' '1.0087' '1.0213' '1.02...

environ 14 heures ago | 0

Answered

Remove all NaN values from an array.

Use these lines idx = any(isnan(D), 2); E = D(~idx, :);

Remove all NaN values from an array.

Use these lines idx = any(isnan(D), 2); E = D(~idx, :);

environ 14 heures ago | 0

| accepted

Answered

Why abs(-5) gives an array and not a single value?

Most probably, you have a function handle or function in your MATLAB path with the name abs(). Try following. First, run clear...

Why abs(-5) gives an array and not a single value?

Most probably, you have a function handle or function in your MATLAB path with the name abs(). Try following. First, run clear...

environ 15 heures ago | 0

Answered

Remove Multiple words From String

Try erase() str = 'with all this stuff going down at the moment '; words_to_remove = {'with ','all ','this ','at ','the '}; n...

Remove Multiple words From String

Try erase() str = 'with all this stuff going down at the moment '; words_to_remove = {'with ','all ','this ','at ','the '}; n...

environ 15 heures ago | 0

Answered

Pole zero plot and frequancy response of a system in MATLAB

It looks strange because the frequency response is usually plotted on logarithmic axes. Replace the line plot(w,abs(H2)) with...

Pole zero plot and frequancy response of a system in MATLAB

It looks strange because the frequency response is usually plotted on logarithmic axes. Replace the line plot(w,abs(H2)) with...

environ 15 heures ago | 0

Answered

Error: Array indices must be positive integers or logical values.

I am not sure what you are trying to do in your code. The following should work just fine theta = [0,45,60] x = cosd(theta)

Error: Array indices must be positive integers or logical values.

I am not sure what you are trying to do in your code. The following should work just fine theta = [0,45,60] x = cosd(theta)

environ 15 heures ago | 0

Answered

Why my plot is not showing?

The following code works correctly on my system. This was a little type in your code file = fopen('data_xi.txt'); reel = fscan...

Why my plot is not showing?

The following code works correctly on my system. This was a little type in your code file = fopen('data_xi.txt'); reel = fscan...

environ 15 heures ago | 0

| accepted

Answered

How to generate a random decimal number between 1.0 and 1.52?

You can generate them by scaling and translating the output of rand() range = [1.0,1.52]; x = rand()*diff(range)+range(1)

How to generate a random decimal number between 1.0 and 1.52?

You can generate them by scaling and translating the output of rand() range = [1.0,1.52]; x = rand()*diff(range)+range(1)

environ 16 heures ago | 0

| accepted

Answered

Concatenating Tables with Regionprops

Letting your table grow dynamically might not an efficient coding approach. It would be better if you save the tables in a cell ...

Concatenating Tables with Regionprops

Letting your table grow dynamically might not an efficient coding approach. It would be better if you save the tables in a cell ...

environ 16 heures ago | 0

| accepted

Answered

how much does matlab cost?

MATLAB has different license types. The cost depends on the type of work you want to do with MATLAB. The pricing is available he...

how much does matlab cost?

MATLAB has different license types. The cost depends on the type of work you want to do with MATLAB. The pricing is available he...

environ 17 heures ago | 0

Answered

How to show the first bar?

Set the lower limit on y-axis too. For example graph1 = bar(a,'stacked','FaceColor','flat'); ax = gca; ax.YScale = 'log'; a...

How to show the first bar?

Set the lower limit on y-axis too. For example graph1 = bar(a,'stacked','FaceColor','flat'); ax = gca; ax.YScale = 'log'; a...

environ 17 heures ago | 0

| accepted

Answered

Loading and accessing the variables, fields and its data into the script from a mat file

This page shows how to access data in a strcut array: https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-structu...

Loading and accessing the variables, fields and its data into the script from a mat file

This page shows how to access data in a strcut array: https://www.mathworks.com/help/matlab/matlab_prog/access-data-in-a-structu...

environ 17 heures ago | 0

| accepted

Answered

how to identify values in a text file and replace them based on an existing array

This is one of the way B=[3;5;4;6;5;3;8]; fid = fopen('data.txt'); data1 = textscan(fid, 'ARF%f=%f'); data2 = textscan(fid...

how to identify values in a text file and replace them based on an existing array

This is one of the way B=[3;5;4;6;5;3;8]; fid = fopen('data.txt'); data1 = textscan(fid, 'ARF%f=%f'); data2 = textscan(fid...

4 jours ago | 0

Answered

Find all occuarances of two numbers together

Try this a = [ 0 -1 1 0 0 -1 1 0]; idx = strfind(a, [1 0])+1; b = zeros(size(a)); b(idx) = 1;

Find all occuarances of two numbers together

Try this a = [ 0 -1 1 0 0 -1 1 0]; idx = strfind(a, [1 0])+1; b = zeros(size(a)); b(idx) = 1;

4 jours ago | 1

| accepted

Answered

How can I use a string in legend()?

Although Walter's comment already shows the problems with eval(), in case you still want to use the current method, then the clo...

How can I use a string in legend()?

Although Walter's comment already shows the problems with eval(), in case you still want to use the current method, then the clo...

4 jours ago | 0

| accepted