Réponse apportée
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);

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
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)

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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; ...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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 = ...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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 ...

plus de 6 ans il y a | 0

Réponse apportée
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_...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 1

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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 ...

plus de 6 ans il y a | 1

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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) ...

plus de 6 ans il y a | 1

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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.

plus de 6 ans il y a | 1

Réponse apportée
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/...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 2

| A accepté

Réponse apportée
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...

plus de 6 ans il y a | 0

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

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

Réponse apportée
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...

plus de 6 ans il y a | 0

| A accepté

Charger plus