Answered

How can I determine which values in vector X are NOT in vector Y?

Z=~ismember(x,y) It will return 0 0 0 which means every element in vector X are also in vector Y.

How can I determine which values in vector X are NOT in vector Y?

Z=~ismember(x,y) It will return 0 0 0 which means every element in vector X are also in vector Y.

4 years ago | 0

Answered

plot signal of time domain

syms x(t) x(t)=sin(2*pi*0.1*t); t=0:0.001:10; plot(t,x(-2*t+3))

plot signal of time domain

syms x(t) x(t)=sin(2*pi*0.1*t); t=0:0.001:10; plot(t,x(-2*t+3))

4 years ago | 0

Answered

how do i plot step response of a system using fourier transform?

If you are dealing with s domain, you need to use ilaplace. Try this: syms t; G = tf([1], [1 0.9 5]); [num,den] = tfdata(G); ...

how do i plot step response of a system using fourier transform?

If you are dealing with s domain, you need to use ilaplace. Try this: syms t; G = tf([1], [1 0.9 5]); [num,den] = tfdata(G); ...

4 years ago | 0

Answered

Matrix Loop Code Question

P_resultant=cumsum([400 -Loss]); P_resultant(1)=[]

Matrix Loop Code Question

P_resultant=cumsum([400 -Loss]); P_resultant(1)=[]

4 years ago | 0

Answered

Covert cell array to array

Something like this? Array=cell2mat(CellArrar.')

Covert cell array to array

Something like this? Array=cell2mat(CellArrar.')

4 years ago | 1

| accepted

Solved

Doubling elements in a vector

Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

4 years ago

Solved

Remove all the words that end with "ain"

Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

4 years ago

Answered

Plotting the solution to a system of second order differential equations

Is there a way I can generate a single plot instead of four plots, for example, the plot of θ(t) vs x(t)? Yes you can, with th...

Plotting the solution to a system of second order differential equations

Is there a way I can generate a single plot instead of four plots, for example, the plot of θ(t) vs x(t)? Yes you can, with th...

4 years ago | 0

| accepted

Answered

Change detection using simulink

I tried to make a model for you, where I tried to build a signal based on your description. Please click on the Signal Builder b...

Change detection using simulink

I tried to make a model for you, where I tried to build a signal based on your description. Please click on the Signal Builder b...

4 years ago | 0

Answered

Typing a long and complicated equation

syms y(t) eq=2*pi*(sqrt((y-44.56)/(-0.16))+1)*sqrt(1+((1)/(-0.32*((sqrt((y-44.56)/(-0.16))+1))+0.32))^2)

Typing a long and complicated equation

syms y(t) eq=2*pi*(sqrt((y-44.56)/(-0.16))+1)*sqrt(1+((1)/(-0.32*((sqrt((y-44.56)/(-0.16))+1))+0.32))^2)

4 years ago | 0

| accepted

Answered

i have a problem with simulink when run simulation it's stop in 2%

Go to Configuration Parameters->Solver section and choose Fixed Step solver and its type as ode5. Then, set the sample time as 0...

i have a problem with simulink when run simulation it's stop in 2%

Go to Configuration Parameters->Solver section and choose Fixed Step solver and its type as ode5. Then, set the sample time as 0...

4 years ago | 0

| accepted

Answered

Maximum and Minimum values of a field structure array

%find max and min population [Cmax,maxIdx]=max(AustralianStates.Population) [Cmin,minIdx]=min(AustralianStates.Population) %f...

Maximum and Minimum values of a field structure array

%find max and min population [Cmax,maxIdx]=max(AustralianStates.Population) [Cmin,minIdx]=min(AustralianStates.Population) %f...

4 years ago | 0

Answered

How to exclude certain rows and columns based on a column value?

Firstly, at your first line of code, you started checking from the beginning of a. Instead, you should be checking the 23rd colu...

How to exclude certain rows and columns based on a column value?

Firstly, at your first line of code, you started checking from the beginning of a. Instead, you should be checking the 23rd colu...

4 years ago | 0

| accepted

Answered

Changing the values of an array with an if condition inside a for-loop

Maybe the following code will get you going: x = 10; y = 10; xo = [20 30 35 50 65]; yo = [13 25 35 38 45]; rho_r = sqrt((x-...

Changing the values of an array with an if condition inside a for-loop

Maybe the following code will get you going: x = 10; y = 10; xo = [20 30 35 50 65]; yo = [13 25 35 38 45]; rho_r = sqrt((x-...

4 years ago | 1

Answered

Calling a derived value as legends in plot

After the loop, run the following line: legend(reshape(sprintf('%d',Zeta),numel(Zeta),1))

Calling a derived value as legends in plot

After the loop, run the following line: legend(reshape(sprintf('%d',Zeta),numel(Zeta),1))

4 years ago | 0

Answered

I need to find the displacement and velocity characteristics of a suspended mass on a boat. I am struggling to develop a state space expression that can take a sinusoidal input, and then to plot graphs of displacement and velocity from this.

You need to define your outputs(with C matrix) correctly. Since you would like to see both displacement and velocity, then C mat...

I need to find the displacement and velocity characteristics of a suspended mass on a boat. I am struggling to develop a state space expression that can take a sinusoidal input, and then to plot graphs of displacement and velocity from this.

You need to define your outputs(with C matrix) correctly. Since you would like to see both displacement and velocity, then C mat...

4 years ago | 0

| accepted

Answered

How to plot a smooth graph?

You need to increase the step size of your t vector: t = linspace(0,10,100); Code: b0 = 0.015; b1 = 0.015; b2 = 0.035; b3 ...

How to plot a smooth graph?

You need to increase the step size of your t vector: t = linspace(0,10,100); Code: b0 = 0.015; b1 = 0.015; b2 = 0.035; b3 ...

4 years ago | 1

| accepted

Answered

How to indicate that there are no zeros for a transfer function for the command zpk?

zpk([],[0 0 0],1) You basically leave zero input section empty as above.

How to indicate that there are no zeros for a transfer function for the command zpk?

zpk([],[0 0 0],1) You basically leave zero input section empty as above.

4 years ago | 3

| accepted

Answered

pid tunnig with non unity feedback

Try the following approach: s=tf('s'); %needed to define transfer function in s domain G=1/3*s+4;H=1/(0.1*s+1); %if feedback i...

pid tunnig with non unity feedback

Try the following approach: s=tf('s'); %needed to define transfer function in s domain G=1/3*s+4;H=1/(0.1*s+1); %if feedback i...

4 years ago | 0

| accepted

Answered

Symbolic solution to a system of algebraic equations

syms a b x N g b L m eqns = [(1/b)*(-2*N*sin(a))/3==m*L, x/b==-(5*L*cos(a))/6+(5*a^2*L*sin(a))/6, N/b==m*(5*L*sin(a))/6+(5*a^2*...

Symbolic solution to a system of algebraic equations

syms a b x N g b L m eqns = [(1/b)*(-2*N*sin(a))/3==m*L, x/b==-(5*L*cos(a))/6+(5*a^2*L*sin(a))/6, N/b==m*(5*L*sin(a))/6+(5*a^2*...

4 years ago | 0

| accepted

Answered

Simple Matrix Reduction Question. Ones and Zeros.

[rows,cols]=find(A==1); [C,I]=sort(rows); B=cols(I)

Simple Matrix Reduction Question. Ones and Zeros.

[rows,cols]=find(A==1); [C,I]=sort(rows); B=cols(I)

4 years ago | 0

| accepted

Answered

Integrating using sums(riemann sums)

You may use rsums. It allows you to interactively calculate the riemann sum integral: rsums(f,5,17.688) Riemann Sum Integral

Integrating using sums(riemann sums)

You may use rsums. It allows you to interactively calculate the riemann sum integral: rsums(f,5,17.688) Riemann Sum Integral

4 years ago | 0

| accepted

Answered

how to solve equation with a function solution matlab

Try this: syms s H2new G1=1/(s-1); G2=s^2-s; H1=s^2-1; H2=-1/s; G=(G1*G2)/(1+G1*H1+G1*G2*H2); H1new=s^2+9*s-10; Gnew=(G1...

how to solve equation with a function solution matlab

Try this: syms s H2new G1=1/(s-1); G2=s^2-s; H1=s^2-1; H2=-1/s; G=(G1*G2)/(1+G1*H1+G1*G2*H2); H1new=s^2+9*s-10; Gnew=(G1...

4 years ago | 1

Answered

Hi I want to generate a signal as a load follow input signal for 80%-50%-80% at 10% per minute for a nuclear power plant control system on simulink? I would be glad for help because i am stucked at this stage?

Run the attached model. I used Signal Builder block to create the input signal.

Hi I want to generate a signal as a load follow input signal for 80%-50%-80% at 10% per minute for a nuclear power plant control system on simulink? I would be glad for help because i am stucked at this stage?

Run the attached model. I used Signal Builder block to create the input signal.

4 years ago | 0

| accepted

Answered

Taking data from matrix and using it in a function

As far as I understand, you want to change E1, E2, E3 and E4 respectively with combinations of -1 and 1. So the following code d...

Taking data from matrix and using it in a function

As far as I understand, you want to change E1, E2, E3 and E4 respectively with combinations of -1 and 1. So the following code d...

4 years ago | 0

Answered

plot the exp function

syms y(t) eq=diff(y,2)+13*diff(y)+40*y==4; Dy=diff(y); Y(t)=dsolve(eq,[y(0)==0 Dy(0)==0]) t=0:0.001:0.9; plot(t,Y(t))

plot the exp function

syms y(t) eq=diff(y,2)+13*diff(y)+40*y==4; Dy=diff(y); Y(t)=dsolve(eq,[y(0)==0 Dy(0)==0]) t=0:0.001:0.9; plot(t,Y(t))

4 years ago | 0

| accepted

Answered

What is better for differential equations - MATLAB or Simulink?

Simulink works numerically, you can not solve differential equations symbolically in Simulink. If you want to obtain symbolic so...

What is better for differential equations - MATLAB or Simulink?

Simulink works numerically, you can not solve differential equations symbolically in Simulink. If you want to obtain symbolic so...

4 years ago | 0

Answered

I want to add a 45-degree line on my plot. I tried some ways (including refline) all give me a 38-degree line!

Try the following: figure(1);hold on; MONTHLY=scatter(X,Y); plot(0:600); %45 degree line plot(0:600,0.73*(0:600)+6.47); %tre...

I want to add a 45-degree line on my plot. I tried some ways (including refline) all give me a 38-degree line!

Try the following: figure(1);hold on; MONTHLY=scatter(X,Y); plot(0:600); %45 degree line plot(0:600,0.73*(0:600)+6.47); %tre...

4 years ago | 1

| accepted

Answered

What is this Simulink Block called in the library browser?

That block seems to be a discretized sine wave. You can find it in Sources library. Also, you can discretize the Sine wave block...

What is this Simulink Block called in the library browser?

That block seems to be a discretized sine wave. You can find it in Sources library. Also, you can discretize the Sine wave block...

4 years ago | 0

Answered

how do i check if a number is a prime number, a square, and or a factor of 6?

n=4; %check if number is prime isprime(n) %returns logical value %check if number is square mod(numel(factor(n)),2)==0 %retu...

how do i check if a number is a prime number, a square, and or a factor of 6?

n=4; %check if number is prime isprime(n) %returns logical value %check if number is square mod(numel(factor(n)),2)==0 %retu...

4 years ago | 1

| accepted