Respondida
How to plot a summation vs the x
When you do sum(y), it sums each element and gives you a scalar value. I think what you want is; H = cumsum(y);

más de 7 años hace | 1

| aceptada

Respondida
Plot root loci with ((K))
You get your transfer function in the form; sys = k*G(s) then to get root locus you call the function rlocus(G)

más de 7 años hace | 0

Respondida
Second time derivative of function?
It does not work, because the length of diff(x) and diff(t) are not the same. diff function takes the difference between each el...

más de 7 años hace | 0

| aceptada

Respondida
How to limit data from a fit?
Create new variables; range = find(x<150); xNew = x(range) yNew = y(range) Obtain your fit using xNew and yN...

más de 7 años hace | 0

Respondida
How do I use loops to model a function of displacement changing with respect to angle over time?
You have a few typos in your implementation and you do not need a for loop either. Here is the code; h = 60; b = 130; ...

más de 7 años hace | 1

| aceptada

Respondida
matlab code to plot and calculate the displacemenet of links in four bar linkage
A simple google search would have given you this <https://www.mathworks.com/matlabcentral/fileexchange/32294-four-bar-linkage-al...

más de 7 años hace | 0

Respondida
Sine wave plot for different frequency
Here is the code; f = 1:20 Fs = 200; % Sampling frequency t = 0:1/Fs:1; % Time vector of 1 second amp = 1; x = ...

más de 7 años hace | 0

| aceptada

Respondida
How to Subtract Consecutive Values in Array in Simulink
You can use a time delay block and use fixed step solver. Set the time delay to be exactly the time step used by the solver. You...

más de 7 años hace | 0

| aceptada

Respondida
Is it possible the Simulink solver make the stable system unstable?
It can. For instance when you choose variable step, different solvers might use different step sizes and for large step sizes th...

más de 7 años hace | 0

Respondida
How to store vector name and value in the result
Here is an example code; xName = ['x1';'x2';'x3';'x4']; xVal = [1;2;3;4]; A = table(xName,xVal); Result look like ...

más de 7 años hace | 0

Respondida
How to solve a linear system with component varying?
Here is one way to do it; index = 0; S = -2:0.01:2; for i = 1:length(S) index = index+1; s_...

más de 7 años hace | 0

| aceptada

Respondida
Hello, I had a problem over here in MATLAB code for solving a linear first ode using RK method of order 5 :dx/dt= lambda-sigma*x(t)- c*v(t),dv/dt=k*v(t)-a*z(t),dz/dt=h*x(t)-tow*v(t) with initial conditions x(0)= x0,v(0)=v0,z(0)=x0.
It is a simple think and there are various code out there. <https://www.mathworks.com/matlabcentral/fileexchange/29851-runge-kut...

más de 7 años hace | 0

Respondida
Plot with respect to time, not samples
You define the time variable yourself. You know that you sample at 9 kHz so you know that between each sample there is 1/8000 se...

más de 7 años hace | 2

| aceptada

Respondida
Four-dimensional contourf plot in Matlab
I do not think there is a way like you imagine but take a look at <https://www.mathworks.com/help/matlab/visualize/overview-of-v...

más de 7 años hace | 0

Respondida
Iterate over vector from result of a for loop
Since the results will be a matrix, you should use 2 index; capacity=[270 -130 470 170 120 20 -30 220 370 4...

más de 7 años hace | 1

Respondida
Why am I getting Undefined function or variable 'kp' despite having defined it in the code?
Becuase you define "kp" variable a little late. From your polyadiabatic function; % Kinetics Rp = (kp).*rho.*A(1).*((2...

más de 7 años hace | 0

| aceptada

Respondida
How can I display elements of a 2D matrix as blue, green and red squares?
A simple fix would be to add 3 additional variables to your matrices that have X and Y values that are outside of your region of...

más de 7 años hace | 0

Respondida
MatLab doesn't read my .TXT file correct
Your data has comma (,) in them. I do not think Matlab can read values with commas, i.e., 2,230. You should change those commas ...

más de 7 años hace | 1

Respondida
How to fix this code
In these lines; xc=sum((x+xp).*a)/6/A yc=sum((y+yp).*a)/6/A when A is 0, these values become NaN since division by 0 is...

más de 7 años hace | 0

Respondida
Count how many times a number is repeated in a certain row of an array
Here is a code; A = [1;1;1;2;2;2;2;2;3;3;4;4;4;4;4;4;4;5;5;5;5]; c = unique(A); % the unique values in the A (1,2,3,4,5) ...

más de 7 años hace | 1

| aceptada

Respondida
I have to shade the area between the two curves, i have used fill function including fliplr, but no success?
Here is how I did it; t= 0:0.1:10; y1 = sin(t); y2 = sin(5*t)-6; fill([t t(end:-1:1)],[y1 y2(end:-1:1) ]','r') <</m...

más de 7 años hace | 0

| aceptada

Respondida
How to solve the following system of ODE's?
Here is a code; syms Po(t) Pi(t) co = 5; cl = 2; pes = 2; pon = 10; peu = 7; R = 34; cs = 23; cb = 10; Q...

más de 7 años hace | 0

Respondida
Find number of terms in taylor expansion upto when error is 10^(-6)
There is an approximation for upper bound on the error (or remaining terms in Taylor expansion). Here is a <https://math.dartmou...

más de 7 años hace | 0

Respondida
Modifying the Tolerance (TolX) inside the Matlab function file (fzero.m).
Feed "optnew" to the fzero function, not "options". You are not changing the setting of options with that command.

más de 7 años hace | 1

Respondida
How I can identify that two different images are of a same person?
A brief google search reveals; # <http://www.scholarpedia.org/article/Eigenfaces Eigenfaces> # <http://www.scholarpedia.org/...

más de 7 años hace | 0

Respondida
I want to determine the magnitude and phase of 100kHz Sinusoidal in a given signal when the sampling rate is 15MHz and when the signal has 32768 samples.
When you do an FFT, you basically assign magnitudes to each frequency. The frequency points are usually called bins and are dete...

más de 7 años hace | 2

| aceptada

Respondida
Hi , how can i plot of the sum of ode solutions using the sum function?
You should use; plot(tv,sum(c(:,1:4)'),'m-') sum command sums each column, however, what you want is the sum of the rows...

más de 7 años hace | 0

Respondida
classifying matrix value based on its element
Is this what you are trying to achieve; a = [201 5 5 306 20 5 ...

más de 7 años hace | 0

Respondida
INDEX EXCEEDS ARRAY BOUNDS
In your code you have slight mistake, where you forgot to assign to an index but instead overwrite the variable ("(i)" is the fi...

más de 7 años hace | 0

Respondida
Draw a line from 2 points and get x and y values
Simple linear interpolation code; % 100 points on the line connecting [x1 y1] and [x2 y2] x = linspace(x1,x2,100); % 100...

más de 7 años hace | 0

| aceptada

Cargar más