Answered

When simulating the response to a specific input signal, the input data U must be a matrix with as many rows as samples in the time vector T, and as many columns as input channels.

Try the following code. By the way, I did not understand why you gave *zeros* as input, therefore I changed it with *ones* vecto...

When simulating the response to a specific input signal, the input data U must be a matrix with as many rows as samples in the time vector T, and as many columns as input channels.

Try the following code. By the way, I did not understand why you gave *zeros* as input, therefore I changed it with *ones* vecto...

12 months ago | 0

Answered

finding all possible Kp and Kd that makes the system stable?

Define this transfer function in MATLAB command line: Gs=tf([1 2 10],[1 5 8 3 12]); and then write pidTuner(Gs) to...

finding all possible Kp and Kd that makes the system stable?

Define this transfer function in MATLAB command line: Gs=tf([1 2 10],[1 5 8 3 12]); and then write pidTuner(Gs) to...

1 year ago | 0

| accepted

Answered

simulink -dervitive in the s domain

The only possible way that you are going to implement that is to use a *Transfer Fcn* block and set its numerator to _s_ and its...

simulink -dervitive in the s domain

The only possible way that you are going to implement that is to use a *Transfer Fcn* block and set its numerator to _s_ and its...

1 year ago | 0

Answered

solving a differential equation

Use *Symbolic* approach: R=1000;L=0.8;C=1e-3; syms v(t) eq=diff(v,2)+(1/(R*C))*diff(v)+v/(L*C)==0; cond1=v(0)==10;...

solving a differential equation

Use *Symbolic* approach: R=1000;L=0.8;C=1e-3; syms v(t) eq=diff(v,2)+(1/(R*C))*diff(v)+v/(L*C)==0; cond1=v(0)==10;...

1 year ago | 0

Answered

algebric loop error while running

Add a *Delay* or *Unit Delay* block in front of the _Product5_ block in your model to solve the issue.

algebric loop error while running

Add a *Delay* or *Unit Delay* block in front of the _Product5_ block in your model to solve the issue.

1 year ago | 0

Answered

unable to compile simulink fft and peak algorithm due to some error.

Enter *Buffer* block and set its _Output buffer size(per channel_ parameter to *3* or to a number more than 3.

unable to compile simulink fft and peak algorithm due to some error.

Enter *Buffer* block and set its _Output buffer size(per channel_ parameter to *3* or to a number more than 3.

1 year ago | 0

Answered

I cant get this plot to work please help me :(

Try this: f1 =@(x) (1./(cosh(x).*cos(x)-1)).*(16.*(-(x.^3).*(cosh(x).*sin(x) + cos(x).*sinh(x))).*(-x.*(cosh(x).*sin(x)-cos...

I cant get this plot to work please help me :(

Try this: f1 =@(x) (1./(cosh(x).*cos(x)-1)).*(16.*(-(x.^3).*(cosh(x).*sin(x) + cos(x).*sinh(x))).*(-x.*(cosh(x).*sin(x)-cos...

1 year ago | 0

| accepted

Answered

How transform cell to logical?

Do you want to convert the elements with number to *true*? Try this: test(cellfun(@(x) ~isempty(x),test))={true} Note tha...

How transform cell to logical?

Do you want to convert the elements with number to *true*? Try this: test(cellfun(@(x) ~isempty(x),test))={true} Note tha...

1 year ago | 0

Answered

Use switch for a matrix row

Use _if_ instead _switch_: if all(M3(i,:)==[0 0 0 0]) if all(M3(i,:)==[1 1 1 1])

Use switch for a matrix row

Use _if_ instead _switch_: if all(M3(i,:)==[0 0 0 0]) if all(M3(i,:)==[1 1 1 1])

1 year ago | 0

Answered

Simulation of a Nonlinear Robotic System with Matrix Coefficients in Simulink

Run the attached model. All you need to do is to change the parameters within MATLAB Function blocks and observe the results. Ho...

Simulation of a Nonlinear Robotic System with Matrix Coefficients in Simulink

Run the attached model. All you need to do is to change the parameters within MATLAB Function blocks and observe the results. Ho...

1 year ago | 0

Answered

how to obtain pid output to 0 to 90 using automatic PID tunner

Are you talking about *saturating* your control signal? There are two options: 1-You can basically use a *Saturation* block f...

how to obtain pid output to 0 to 90 using automatic PID tunner

Are you talking about *saturating* your control signal? There are two options: 1-You can basically use a *Saturation* block f...

1 year ago | 0

Answered

Simplification of "for" loop MATLAB R2018a

By the power of *implicit expansion* starting from R2016b in MATLAB, your desire can be achieved in one line of code: r=resh...

Simplification of "for" loop MATLAB R2018a

By the power of *implicit expansion* starting from R2016b in MATLAB, your desire can be achieved in one line of code: r=resh...

1 year ago | 1

| accepted

Answered

How to generate all the 3 by 3 matrices ?

One approach: while true A=randi([1 20],3,3); if (2*A(1,1)<=(A(1,2)+A(2,1))) && (A(1,1)<=A(2,2) && A(1,1)<=A(...

How to generate all the 3 by 3 matrices ?

One approach: while true A=randi([1 20],3,3); if (2*A(1,1)<=(A(1,2)+A(2,1))) && (A(1,1)<=A(2,2) && A(1,1)<=A(...

1 year ago | 0

| accepted

Answered

problem with taking Differentiate from variable with counter !

Well, the approach would be as follows: n=30; x=sym(zeros(1,n));%preallocation syms t for i=1:n x(i)=str2sym...

problem with taking Differentiate from variable with counter !

Well, the approach would be as follows: n=30; x=sym(zeros(1,n));%preallocation syms t for i=1:n x(i)=str2sym...

1 year ago | 0

| accepted

Answered

Limit the values of the extreme elements of a vector.

Maybe this will help: low=0;up=10;n=9; A=[0 sort(low+(up-low)*rand(1,n))]

Limit the values of the extreme elements of a vector.

Maybe this will help: low=0;up=10;n=9; A=[0 sort(low+(up-low)*rand(1,n))]

1 year ago | 0

| accepted

Answered

How do I find the average of all rows across a series of columns?

You do not need a loop for this. Consider the following case: A=randi([1 4],1000,10);%demo data res=mean(A,2); *res* va...

How do I find the average of all rows across a series of columns?

You do not need a loop for this. Consider the following case: A=randi([1 4],1000,10);%demo data res=mean(A,2); *res* va...

1 year ago | 0

| accepted

Answered

What is the triangular block symbol in this model?

It looks like a _logical operator_. You need to check the *Logical Operator* block for that purpose.

What is the triangular block symbol in this model?

It looks like a _logical operator_. You need to check the *Logical Operator* block for that purpose.

1 year ago | 0

Answered

I am plotting (x,y) coordinates in a simple plot and the plotted values lies in 1st Quadrant.However, I want to see all the 4 quadrants , how to customize it?

Try this: x=0:5;y=0:5; plot(x,y);grid on; set(gca,'XLim',[-20 20]); set(gca,'YLim',[-20 20]);

I am plotting (x,y) coordinates in a simple plot and the plotted values lies in 1st Quadrant.However, I want to see all the 4 quadrants , how to customize it?

Try this: x=0:5;y=0:5; plot(x,y);grid on; set(gca,'XLim',[-20 20]); set(gca,'YLim',[-20 20]);

1 year ago | 0

| accepted

Answered

save data from all loop iterations

You need to read about _for loop_ and _subscripting_. <https://www.mathworks.com/help/matlab/ref/for.html>

save data from all loop iterations

You need to read about _for loop_ and _subscripting_. <https://www.mathworks.com/help/matlab/ref/for.html>

1 year ago | 0

Answered

How to create a specific diagonal Matrix

Try this: T=3; for i=1:T A(i,:)=circshift([ones(1,T) zeros(1,T^2-T)],T*(i-1)); end

How to create a specific diagonal Matrix

Try this: T=3; for i=1:T A(i,:)=circshift([ones(1,T) zeros(1,T^2-T)],T*(i-1)); end

1 year ago | 0

Answered

Have a function take a string and an number as an input?

If you call it as follows, it works perfectly: >>alloy='Al2'; T=300; [Alloy,Temp]=ThCond(alloy,T) The thermal co...

Have a function take a string and an number as an input?

If you call it as follows, it works perfectly: >>alloy='Al2'; T=300; [Alloy,Temp]=ThCond(alloy,T) The thermal co...

1 year ago | 0

| accepted

Answered

How do we calculate the integration of an imput handle function

*int* is used to calculate integrals of *symbolic functions*. To find integral of function handle, use *integral*. <https://w...

How do we calculate the integration of an imput handle function

*int* is used to calculate integrals of *symbolic functions*. To find integral of function handle, use *integral*. <https://w...

1 year ago | 0

Answered

could anyone tell me is it possible to solve the issue.

Use *hold on* to plot both graphs in one figure.

could anyone tell me is it possible to solve the issue.

Use *hold on* to plot both graphs in one figure.

1 year ago | 0

Answered

how do i fix Initialize Variables error when starting quadcopter model in simulink?

Use *File->Model Properties->Model Properties->Callbacks->PreLoadFcn* to initialize variables automatically every time you open ...

how do i fix Initialize Variables error when starting quadcopter model in simulink?

Use *File->Model Properties->Model Properties->Callbacks->PreLoadFcn* to initialize variables automatically every time you open ...

1 year ago | 0

Answered

I need help having my function display both outputs

When I call it as follows: [Eupper ,Elower]=HS(5,3,7,6,2,5,4) %inputs are random it gives me both output.

I need help having my function display both outputs

When I call it as follows: [Eupper ,Elower]=HS(5,3,7,6,2,5,4) %inputs are random it gives me both output.

1 year ago | 0

| accepted

Answered

Find a letter position within a word.

This might help you: function indexes = find_letter_positions(word,letter) indexes = zeros(1,numel(word)); for i = 1:...

Find a letter position within a word.

This might help you: function indexes = find_letter_positions(word,letter) indexes = zeros(1,numel(word)); for i = 1:...

1 year ago | 0

| accepted

Answered

Fourier Series in matlab with for loop

You do not need a _for loop_. If you have *Symbolic Toolbox*, the following code should do it: syms f(t) n k=5; %upper l...

Fourier Series in matlab with for loop

You do not need a _for loop_. If you have *Symbolic Toolbox*, the following code should do it: syms f(t) n k=5; %upper l...

1 year ago | 0

Answered

How make an equivalent function of unit delay in matlab

*Delay* block comes with its _Input Port_ choice within the mask in its *Source*. Check the attached figures.

How make an equivalent function of unit delay in matlab

*Delay* block comes with its _Input Port_ choice within the mask in its *Source*. Check the attached figures.

1 year ago | 0

Answered

Store results from loop.

I believe you need to read about _for loop_ and _subscripting_. Try this: As1=510; fy=420; h = 650; d = 590; Es = 200000; ...

Store results from loop.

I believe you need to read about _for loop_ and _subscripting_. Try this: As1=510; fy=420; h = 650; d = 590; Es = 200000; ...

1 year ago | 1

Answered

loop in sum series and product

You don't need a _for loop_. If you have *Symbolic Toolbox*, you can easily calculate it as: syms t n l=3;m=6;k=3; %rand...

loop in sum series and product

You don't need a _for loop_. If you have *Symbolic Toolbox*, you can easily calculate it as: syms t n l=3;m=6;k=3; %rand...

1 year ago | 0