Answered

Find elements in a matrix

You can get the indices with: idx = A >= 30 & A <= 65 To know the number of values corresponding to the condition: numel(find...

Find elements in a matrix

You can get the indices with: idx = A >= 30 & A <= 65 To know the number of values corresponding to the condition: numel(find...

5 years ago | 0

Answered

Is there any maximum for the size of matlab table?

It depends on what you want to store into this table. You can have a look here to find more informations: https://mathworks.com...

Is there any maximum for the size of matlab table?

It depends on what you want to store into this table. You can have a look here to find more informations: https://mathworks.com...

5 years ago | 0

Answered

function rand with variables

You can use something like this, adapt it to your case: a = 1; b = 2; c = 3; A = [a b c]; nb = 10; vec = zeros(1,nb); for...

function rand with variables

You can use something like this, adapt it to your case: a = 1; b = 2; c = 3; A = [a b c]; nb = 10; vec = zeros(1,nb); for...

5 years ago | 0

Answered

('tf' requires one of the following) "tf commend is not working" HELP PLS!

Your code is right, but you do not have the required toolbox. The function tf is part of the 4 toolbox listed in the error messa...

('tf' requires one of the following) "tf commend is not working" HELP PLS!

Your code is right, but you do not have the required toolbox. The function tf is part of the 4 toolbox listed in the error messa...

5 years ago | 6

| accepted

Answered

Any methods to solve optimal control indirect method such as Pontryagin Minimum Principle?

Hi, here are some related questions to start with: https://mathworks.com/matlabcentral/answers/440335-how-to-implement-optimal...

Any methods to solve optimal control indirect method such as Pontryagin Minimum Principle?

Hi, here are some related questions to start with: https://mathworks.com/matlabcentral/answers/440335-how-to-implement-optimal...

5 years ago | 0

| accepted

Answered

Vectors must be the same length.

What lines causes the error ? Following one ? g = plot(t,delta_omega_laser ); t and delta_omega_laser must have the same leng...

Vectors must be the same length.

What lines causes the error ? Following one ? g = plot(t,delta_omega_laser ); t and delta_omega_laser must have the same leng...

5 years ago | 0

| accepted

Answered

assign variable name to Function Output Variables

Why don't you just change [wave_rms]=waveform(wave) into [Uph_rms]=waveform(wave) ?

assign variable name to Function Output Variables

Why don't you just change [wave_rms]=waveform(wave) into [Uph_rms]=waveform(wave) ?

5 years ago | 0

Answered

Taking in a function as an argument

How is testfunc defined ? Here is a simple working example: function out = func(inputfunc, constant1, constant2) out = inputf...

Taking in a function as an argument

How is testfunc defined ? Here is a simple working example: function out = func(inputfunc, constant1, constant2) out = inputf...

5 years ago | 0

Answered

How idx runs and give its value ?

abs(a-n) = 1.8000 2.0000 4.0000 6.3000 6.5000 then min(abs(a-n)) = 1.8, and the location of this minimum value...

How idx runs and give its value ?

abs(a-n) = 1.8000 2.0000 4.0000 6.3000 6.5000 then min(abs(a-n)) = 1.8, and the location of this minimum value...

5 years ago | 0

Answered

Servo control without controller

have you tried something so far ? Do you need help to connect matlab and the motor ? In this case you should specify what is y...

Servo control without controller

have you tried something so far ? Do you need help to connect matlab and the motor ? In this case you should specify what is y...

5 years ago | 0

Answered

plot a defined function

plot the function N(T) versus T in range 0.1 to 14 T is known ? T =[0.1 : 14 ] ? And you want to plot ne(T) ? In this case yo...

plot a defined function

plot the function N(T) versus T in range 0.1 to 14 T is known ? T =[0.1 : 14 ] ? And you want to plot ne(T) ? In this case yo...

5 years ago | 0

Answered

Problem with Discrete Controller Design

It could actually be both. It is indeed possible that the discretization with a given frequency brings problems such as oversa...

Problem with Discrete Controller Design

It could actually be both. It is indeed possible that the discretization with a given frequency brings problems such as oversa...

5 years ago | 0

Answered

If the values are almost equal to each other,how do i plot the figure to see its curve? (not straight line )

I am not sure to understand the question, but the following code answer your question ? a=[1 2 3 4]; x=[x1 x2 x3 x4]; % your d...

If the values are almost equal to each other,how do i plot the figure to see its curve? (not straight line )

I am not sure to understand the question, but the following code answer your question ? a=[1 2 3 4]; x=[x1 x2 x3 x4]; % your d...

5 years ago | 0

Answered

obsvf confused by documentation

You were right, the documentation for obsvf function has been updated recently: https://mathworks.com/help/control/ref/obsvf.ht...

obsvf confused by documentation

You were right, the documentation for obsvf function has been updated recently: https://mathworks.com/help/control/ref/obsvf.ht...

5 years ago | 0

Answered

HOW TO MAKE FUNCTION HANDLING PROPERLY IN DIFFERENT MATLAB FILES?

The way to call functions in matlab is explained here: https://fr.mathworks.com/matlabcentral/answers/179803-calling-a-function...

HOW TO MAKE FUNCTION HANDLING PROPERLY IN DIFFERENT MATLAB FILES?

The way to call functions in matlab is explained here: https://fr.mathworks.com/matlabcentral/answers/179803-calling-a-function...

5 years ago | 0

| accepted

Answered

How to take the average of different initial conditions

It is not clear what you want to do from the code you posted, especially the first loop : for j = 1: length (g) ... end ...

How to take the average of different initial conditions

It is not clear what you want to do from the code you posted, especially the first loop : for j = 1: length (g) ... end ...

5 years ago | 0

Answered

Not enough input argumaents

It depends on how you call this function, try to call if from the command window : x = 1; y = 2; s = add(x,y); And then you...

Not enough input argumaents

It depends on how you call this function, try to call if from the command window : x = 1; y = 2; s = add(x,y); And then you...

5 years ago | 0

Answered

how to find matching elements of two colums vectors

It depends what you want exactly. Let's say you have two vectors a and b: a=[1;2;3;4]; b=[0;2;3;5]; To find the indices wher...

how to find matching elements of two colums vectors

It depends what you want exactly. Let's say you have two vectors a and b: a=[1;2;3;4]; b=[0;2;3;5]; To find the indices wher...

5 years ago | 0

Answered

matlab 2014b windows 10

Follow this link and select the matlab version you want to download : https://mathworks.com/downloads/web_downloads/select_rele...

matlab 2014b windows 10

Follow this link and select the matlab version you want to download : https://mathworks.com/downloads/web_downloads/select_rele...

5 years ago | 0

Answered

How to caculate a value for a step - the previous step

It depends on what you mean by "I have a value x". It is actuallyquite easy to do for a straightforward example, but it depends...

How to caculate a value for a step - the previous step

It depends on what you mean by "I have a value x". It is actuallyquite easy to do for a straightforward example, but it depends...

5 years ago | 0

Answered

Restrict user string inputs

The problem comes from your conditions: ~strcmp(y,'i') | ~strcmp(y,'m') This is never true, even if you enter 'i' or 'm'. Wh...

Restrict user string inputs

The problem comes from your conditions: ~strcmp(y,'i') | ~strcmp(y,'m') This is never true, even if you enter 'i' or 'm'. Wh...

5 years ago | 0

Answered

How can I call a .m function with App Designer?

Yes it is possible, have a look at this tutorial and introduction video: https://mathworks.com/help/matlab/creating_guis/create...

How can I call a .m function with App Designer?

Yes it is possible, have a look at this tutorial and introduction video: https://mathworks.com/help/matlab/creating_guis/create...

5 years ago | 0

| accepted

Answered

facing problem in writing complex programme

Can you show the entire error message ? You have at least one error at line 5: part1=beta /lamda(0.5-delta+delta^2); sayi...

facing problem in writing complex programme

Can you show the entire error message ? You have at least one error at line 5: part1=beta /lamda(0.5-delta+delta^2); sayi...

5 years ago | 0

| accepted

Answered

how to use a graph from user input as input to the matlab program

In this case, I recommend you use lsim: https://mathworks.com/help/control/ref/lsim.html

how to use a graph from user input as input to the matlab program

In this case, I recommend you use lsim: https://mathworks.com/help/control/ref/lsim.html

5 years ago | 0

Answered

How can I plot an internal value in a state space model?

Given that the voltage is not a directly controlled input, I do no know how to get this value during a simulation. Is u the vol...

How can I plot an internal value in a state space model?

Given that the voltage is not a directly controlled input, I do no know how to get this value during a simulation. Is u the vol...

5 years ago | 0

Answered

how to form matrix

From this documentation: https://mathworks.com/help/matlab/learn_matlab/matrices-and-arrays.html Try: m = [ m11 m12 ...

how to form matrix

From this documentation: https://mathworks.com/help/matlab/learn_matlab/matrices-and-arrays.html Try: m = [ m11 m12 ...

5 years ago | 0

Answered

Expressing an even number in powers of 2 and a multiple of an odd number.

I would do something like a = 80; r = 1; d = a/2; while mod(d,2)==0 r=r+1; d=d/2; end

Expressing an even number in powers of 2 and a multiple of an odd number.

I would do something like a = 80; r = 1; d = a/2; while mod(d,2)==0 r=r+1; d=d/2; end

5 years ago | 0

Answered

Simulink Serial Receive, Selection of communication port

This was a problem related to permission right, I had to acces to the device as an admin to be able to communicate with it.

Simulink Serial Receive, Selection of communication port

This was a problem related to permission right, I had to acces to the device as an admin to be able to communicate with it.

5 years ago | 0

| accepted

Answered

Nyquist plot from 0 to Inf (only frequencies > 0)

If you specify the frequency as W = {WMIN,WMAX} WMIN and WMAX are real frequencies satisfying 0<=WMIN<WMAX<=Inf. So by settin...

Nyquist plot from 0 to Inf (only frequencies > 0)

If you specify the frequency as W = {WMIN,WMAX} WMIN and WMAX are real frequencies satisfying 0<=WMIN<WMAX<=Inf. So by settin...

5 years ago | 0

Answered

How can the output be written in a new column (without overwriting the previous one)

You can use cell for that. You can try and adapt the following example: a=cell(3,1); for i=1:3 a{i}=ones(i,1); end a ...

How can the output be written in a new column (without overwriting the previous one)

You can use cell for that. You can try and adapt the following example: a=cell(3,1); for i=1:3 a{i}=ones(i,1); end a ...

5 years ago | 0