Risposto
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);

quasi 6 anni fa | 1

| accettato

Risposto
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)

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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; ...

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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 = ...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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 ...

circa 6 anni fa | 0

Risposto
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_...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 2

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 1

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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 ...

circa 6 anni fa | 1

Risposto
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...

circa 6 anni fa | 0

Risposto
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) ...

circa 6 anni fa | 1

| accettato

Risposto
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...

circa 6 anni fa | 0

| accettato

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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.

circa 6 anni fa | 1

Risposto
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/...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 2

| accettato

Risposto
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...

circa 6 anni fa | 0

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

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

Risposto
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...

circa 6 anni fa | 0

| accettato

Carica altro