Answered

How to set different intervals using linspace()?

If you want to remove a certain element; x = linspace(1,100,1e3); % 1000 elements i = 100; % index to be remov...

How to set different intervals using linspace()?

If you want to remove a certain element; x = linspace(1,100,1e3); % 1000 elements i = 100; % index to be remov...

22 days ago | 0

| accepted

Answered

error in subcript must real integers or logicals

If you run this portion ((idemod-1)*length(tmod)+1:idemod*length(tmod)).*cos(2*pi*fc*tmod) which you use as index, you will se...

error in subcript must real integers or logicals

If you run this portion ((idemod-1)*length(tmod)+1:idemod*length(tmod)).*cos(2*pi*fc*tmod) which you use as index, you will se...

29 days ago | 0

| accepted

Answered

How to exchange between X and Y axes in a 3D graph?

You can use a code like; h = findobj(gca,'Type','line') x=get(h,'Xdata') y=get(h,'Ydata') z=get(h,'Zdata') This will extrac...

How to exchange between X and Y axes in a 3D graph?

You can use a code like; h = findobj(gca,'Type','line') x=get(h,'Xdata') y=get(h,'Ydata') z=get(h,'Zdata') This will extrac...

29 days ago | 0

Answered

How to Design a Full Order Observer in MATLAB?

place() function is for controller design not related to observers. The function finds a state feedback control law, u = Kx, suc...

How to Design a Full Order Observer in MATLAB?

place() function is for controller design not related to observers. The function finds a state feedback control law, u = Kx, suc...

4 months ago | 0

Answered

any input function to transfer functionm

I think the function you are looking for is lsim(). The usage is pretty simple. t = 0:1e-3:10; % time vector u = rand...

any input function to transfer functionm

I think the function you are looking for is lsim(). The usage is pretty simple. t = 0:1e-3:10; % time vector u = rand...

4 months ago | 0

Answered

State Space block state vector value

To do that you need to specify your states as outputs by modifying your C matrix. C = [1 2 3 4]; % original C matrix that giv...

State Space block state vector value

To do that you need to specify your states as outputs by modifying your C matrix. C = [1 2 3 4]; % original C matrix that giv...

5 months ago | 0

Answered

how to design a notch filter in matlab

Here is one way; alpha= 2000; % determines the depth f = 650*2*pi;% notch filter frequecy (rad/s) x = 0.1; % no...

how to design a notch filter in matlab

Here is one way; alpha= 2000; % determines the depth f = 650*2*pi;% notch filter frequecy (rad/s) x = 0.1; % no...

6 months ago | 0

Answered

modify axis in time series

You are not clear on what you want to do but from what I understand, you want to change the x labels from 0-2-4-6.. to something...

modify axis in time series

You are not clear on what you want to do but from what I understand, you want to change the x labels from 0-2-4-6.. to something...

6 months ago | 0

Answered

FOR loop calculating next values using the previous values

Your for loop cannot go upto size(Xin,1). Imagine Xin has 10 elements. For calculation of M10, you would need to access Xin(11),...

FOR loop calculating next values using the previous values

Your for loop cannot go upto size(Xin,1). Imagine Xin has 10 elements. For calculation of M10, you would need to access Xin(11),...

7 months ago | 0

| accepted

Answered

Plotting contours of Z on an x-y axis where Z is not a function of x or y

You do not have a lot of data so the countour map will not look great. However what you need to do is; % create data x = [0.2 ...

Plotting contours of Z on an x-y axis where Z is not a function of x or y

You do not have a lot of data so the countour map will not look great. However what you need to do is; % create data x = [0.2 ...

7 months ago | 0

| accepted

Answered

How can i get fourier transform of this function

Here is a one way of doing it; clear;clc A = 2; f = @(t,t1,t2) A.*((t1<t) & (t<t2)); Fs = 1000; t = 0:(1/Fs):...

How can i get fourier transform of this function

Here is a one way of doing it; clear;clc A = 2; f = @(t,t1,t2) A.*((t1<t) & (t<t2)); Fs = 1000; t = 0:(1/Fs):...

7 months ago | 0

Answered

about why in pole placement gives me error?

It is just the error says. Place command cannot place poles with multiplicity greater than rank(B). In your case, rank(B) is 1. ...

about why in pole placement gives me error?

It is just the error says. Place command cannot place poles with multiplicity greater than rank(B). In your case, rank(B) is 1. ...

7 months ago | 0

| accepted

Answered

tfestimate gives different results for different Fs

It is because when you change the sampling time, you are basically playing with the fft of the signal. You should use Ts value o...

tfestimate gives different results for different Fs

It is because when you change the sampling time, you are basically playing with the fft of the signal. You should use Ts value o...

7 months ago | 0

Answered

My simulation is showing very small time not the total time period. Can anyone suggest the solution

In the setting of the scope (the gear symbol on the left top corner), there is a 'history' tab. In there remove the tick from 'L...

My simulation is showing very small time not the total time period. Can anyone suggest the solution

In the setting of the scope (the gear symbol on the left top corner), there is a 'history' tab. In there remove the tick from 'L...

7 months ago | 0

| accepted

Answered

How to change load(resistance) while simulation is running

The easiest way is to use the switch block. You can either use simulation time to determine when to switch or define some condit...

How to change load(resistance) while simulation is running

The easiest way is to use the switch block. You can either use simulation time to determine when to switch or define some condit...

7 months ago | 0

| accepted

Answered

bode plot from mass, stiffness and damping matrix

First of all, I think your M K and D matrices are not for a spring mass damper system. They do not have any negative elements in...

bode plot from mass, stiffness and damping matrix

First of all, I think your M K and D matrices are not for a spring mass damper system. They do not have any negative elements in...

7 months ago | 1

| accepted

Answered

What is the purpose of Gmin and Gmax value in Hinfinty controller

From the function page you can find the information you need. I am pasting it here for convenience. --------------- Performanc...

What is the purpose of Gmin and Gmax value in Hinfinty controller

From the function page you can find the information you need. I am pasting it here for convenience. --------------- Performanc...

7 months ago | 0

Answered

how to simulate an impusles response of a transfer function?

An impulse signal is a signal that has a certain magnitude that is applied for a small time. So you can use transfer function bl...

how to simulate an impusles response of a transfer function?

An impulse signal is a signal that has a certain magnitude that is applied for a small time. So you can use transfer function bl...

8 months ago | 0

Answered

How to realize a multiloop system in matlab?

Find below a simple example; A = rand(3); % random system A matrix B = rand(3,2); % random input B matrix C = eye(3); %...

How to realize a multiloop system in matlab?

Find below a simple example; A = rand(3); % random system A matrix B = rand(3,2); % random input B matrix C = eye(3); %...

8 months ago | 0

Answered

For loop for fibonacci series

In case of series, it is better to store each value. Please see below code that generatesa fibonacci sequence, and stores all th...

For loop for fibonacci series

In case of series, it is better to store each value. Please see below code that generatesa fibonacci sequence, and stores all th...

8 months ago | 0

| accepted

Answered

ODE function does not seem to work

First error is in sdof function. There should be a semicolon after c=1 and before m=3; k=3; c=1; m=3; Second error is in yo...

ODE function does not seem to work

First error is in sdof function. There should be a semicolon after c=1 and before m=3; k=3; c=1; m=3; Second error is in yo...

8 months ago | 0

Answered

How can I design a PID Controller to stabllize the plant 1/(s^3+1) ? [beginner]

So you have a transfer function G(s) = 1/(s^3+1) and you want to find gains P,I,D for your controller K(s) = P+D*s+I/s. As commo...

How can I design a PID Controller to stabllize the plant 1/(s^3+1) ? [beginner]

So you have a transfer function G(s) = 1/(s^3+1) and you want to find gains P,I,D for your controller K(s) = P+D*s+I/s. As commo...

8 months ago | 1

| accepted

Answered

MIMO ss2tf, how do I apply it to a 3x3 system?

You can try using just tf (if you are using one of the newer versions of Matlab) sys = ss(rand(6),rand(6,3),rand(3,6),0); %...

MIMO ss2tf, how do I apply it to a 3x3 system?

You can try using just tf (if you are using one of the newer versions of Matlab) sys = ss(rand(6),rand(6,3),rand(3,6),0); %...

8 months ago | 0

Answered

Plotting circle using angle and radius

Next time, share your code so that we can debug your code. My guess is you angle are from +90 degrees to -90 degrees instead of ...

Plotting circle using angle and radius

Next time, share your code so that we can debug your code. My guess is you angle are from +90 degrees to -90 degrees instead of ...

9 months ago | 0

Answered

Forced step response of a signal

I recommend you look into <https://www.mathworks.com/help/control/ref/lsim.html lsim()> function, which is a lot more flexible t...

Forced step response of a signal

I recommend you look into <https://www.mathworks.com/help/control/ref/lsim.html lsim()> function, which is a lot more flexible t...

9 months ago | 0

| accepted

Answered

Index exceeds number of array elements (1)?

You only define V2(1) in your code and do not increase the size of the V2 variable. So I think you are missing a code in your fo...

Index exceeds number of array elements (1)?

You only define V2(1) in your code and do not increase the size of the V2 variable. So I think you are missing a code in your fo...

9 months ago | 0

| accepted

Answered

How to subplot data in a given order?

Below modification will make the subplot in the order presented in the ch_order variable. ch_order = [6 4 2 1 3 5]; fo...

How to subplot data in a given order?

Below modification will make the subplot in the order presented in the ch_order variable. ch_order = [6 4 2 1 3 5]; fo...

9 months ago | 0

| accepted

Answered

how can i find Open loop Transfer Function from Closed loop Transfer Function

From the basics of control theory you should know that for a given system G(s), the closed loop transfer function with unity fe...

how can i find Open loop Transfer Function from Closed loop Transfer Function

From the basics of control theory you should know that for a given system G(s), the closed loop transfer function with unity fe...

9 months ago | 2

Answered

Steady state doesn't appear in step response plot

The bad_sys works if you call the step function with; step(minreal(bad_sys/(1+bad_sys))) I am not sure about the exact r...

Steady state doesn't appear in step response plot

The bad_sys works if you call the step function with; step(minreal(bad_sys/(1+bad_sys))) I am not sure about the exact r...

9 months ago | 0

| accepted