已回答
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);

6 years 前 | 1

| 已接受

已回答
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)

6 years 前 | 0

已回答
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...

6 years 前 | 0

| 已接受

已回答
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...

6 years 前 | 0

已回答
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; ...

6 years 前 | 1

| 已接受

已回答
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...

6 years 前 | 0

已回答
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 = ...

6 years 前 | 0

| 已接受

已回答
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...

6 years 前 | 0

| 已接受

已回答
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...

6 years 前 | 0

已回答
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 ...

6 years 前 | 0

已回答
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_...

6 years 前 | 0

| 已接受

已回答
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...

6 years 前 | 0

已回答
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...

6 years 前 | 2

| 已接受

已回答
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...

6 years 前 | 0

已回答
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...

6 years 前 | 1

已回答
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...

6 years 前 | 0

| 已接受

已回答
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...

6 years 前 | 0

已回答
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 ...

6 years 前 | 1

已回答
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...

6 years 前 | 0

已回答
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) ...

6 years 前 | 1

| 已接受

已回答
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...

6 years 前 | 0

| 已接受

已回答
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...

6 years 前 | 0

已回答
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...

6 years 前 | 0

已回答
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.

6 years 前 | 1

已回答
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/...

6 years 前 | 0

已回答
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...

6 years 前 | 2

| 已接受

已回答
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...

6 years 前 | 0

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

6 years 前 | 0

已回答
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...

6 years 前 | 0

已回答
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...

6 years 前 | 0

| 已接受

加载更多