Answered
Need some guidance of bimolecular reaction
I have no idea what the initial conditions are suposed to be, however it works correctly with: tspan = [0 20]; ic = rand(6,1)...

6 years ago | 1

Answered
Vector of n elements
Try this: v = 1:n; vs = cumsum(v) .

6 years ago | 0

| accepted

Answered
Polynomial coefficients in descending powers of s
Try this: s = tf('s'); p = 4*s^4 - s^3 + 8*s^2 + 9; coefficients = p.Numerator{:} producing: coefficients = 4 ...

6 years ago | 0

| accepted

Answered
How to write an objective function of optimization Problem in MATLAB containing three Sums?
If I am reading it correctly, all the nested sums should produce one scalar result, so use that as the output of the fitness fun...

6 years ago | 0

Answered
Get 10 seconds of a signal
A simple calculation to get the number of samples needed is: number_of_samples = number_of_seconds)*(samples / second) For 1...

6 years ago | 0

Answered
Fill out Plot between V_Out1 and V_Out3
Add these patch calls: patch([t1 fliplr(t1)], [V_Out2 fliplr(V_Out3)], 'r', 'FaceAlpha',0.1, 'EdgeColor','none') % V_Out...

6 years ago | 0

Answered
Error in reading csv file with xlsread
I had no problems reading it and plotting it with xlsread (although I cannot determine if the data are plotted correctly becaus...

6 years ago | 0

| accepted

Answered
state space of computation for combination of two plants
Multiply them, or use the series function. The Control System Toolbox does everything else. Example — A1 = randi(9,2) B1...

6 years ago | 0

Answered
How to delete the first line in txt file?
The readtable function willl create VariableNames from the first line. For most of the other functions (such as textscan) use...

6 years ago | 0

| accepted

Answered
Problem with my non linear pendulum code
Eliminate the space: plot(t,u(:,1),'b-', 'Line Width', 2) ↑ ← HERE It should be: pl...

6 years ago | 1

| accepted

Answered
Sttopping the iteration at a certain value
The ‘F’ variable is apparently defined before the loop and does not appear to be changed within the loop. Therefore, ‘r’ never ...

6 years ago | 0

| accepted

Answered
How to extract frequency and time components of an existing audio 'sound.wav' file?
It’s possible to recover much of that information in the signal: [s,f,t] = spectrogram(audioIn,blackman(500),100,150,fs); ...

6 years ago | 1

| accepted

Answered
How to make the code read excel file?
Use the readmatrix function (or xlsread if you do not have readmatrix). There are also others, such as readtable, depending on ...

6 years ago | 0

| accepted

Answered
How to determine the mean of certain y values ?
It would be helpful to see all the relevant code. However on the basis of what you posted, taking the mean of ‘ind’ is going ...

6 years ago | 1

| accepted

Answered
inverce laplace and ploting data
I believe that what you actually want is: s = zpk('s') Gs=(9)/(s^2+9*s+9); pole(Gs) zero(Gs) % Ct=ilaplace(Gs) figure st...

6 years ago | 0

Answered
fzero function with cases
The correct way to use ‘f’ with fzero in the posted code is: y = fzero(@(e)f(e,par), [e,e+0.1]); There are too many missing v...

6 years ago | 0

| accepted

Answered
store data in struct using two instances of textscan on same file in for loop
It will probably be necessary to stop textscan after it completes reading a section of the file with one format string, and then...

6 years ago | 0

Answered
Help with my 2nd Order ODE Solver.
Trigger the event on ‘y(1)’, and set ‘gd’ to zero: function [value, isterminal, direction] = ground(t,y) gd = 0; val...

6 years ago | 1

| accepted

Answered
What is the meaning of 'Threshold' if I use the 'ischange' function?
The Threshold name-value pair argument is not well-documented, other than that it ‘defines the number of detected change points’...

6 years ago | 0

Answered
Applying a Notch-filter to filter my MEP-data
Using second-order-section representation is certainly the best option. However if FieldTrip (that I have no experience with) fo...

6 years ago | 1

| accepted

Answered
Rotation and shifting of a plot
I am not certain what you want the plot to look like. Try this: figure plot((ka)+pi, fliplr(E/1.6e-19)) xlabel('ka') y...

6 years ago | 1

| accepted

Answered
Not enough input arguments.
It appears that some of the variables necessary for the ‘lHsHc’ calculationwere not passed to the ‘XXKHB’ function. They may no...

6 years ago | 0

Answered
Solving coupled 2nd order differential equations
Try this: syms O a g L x(t) y(t) t Y ; dx = diff(x); d2x = diff(x,2); dy = diff(y); d2y = diff(y,2); Eq1 = d2x == 2*O*sin...

6 years ago | 0

| accepted

Answered
How can I put a string variable into a Figure Title?
You’re almost there! Add a sprintf call and it does what you want: title(sprintf('FILE %s: X vs Y (dB Mag)', FILE_NAME)) a...

6 years ago | 3

| accepted

Answered
How were these two plots created?
The top plot image appears to be a heatmap. The lower plot image is most likely a surf plot using the view function (specific...

6 years ago | 0

| accepted

Answered
shadow the area between two curves in a plot
I do not have your data, so I created my own. You may have to change it slightly to fit your intended application. Try this:...

6 years ago | 0

| accepted

Answered
Step and Impulse responce
If you want to use the Symbolic Math Toolbox: syms s Gs=(1000)/(s^2+34.5*s+1000); Rs=1/s; Cs=Gs*Rs Ct=ilaplace(Cs) figu...

6 years ago | 1

Answered
How can I plot the magnitude spectrums of the signal before and after filtering
You need to take the Fourier transforms of both signals.

6 years ago | 0

| accepted

Answered
Saving loop entries and plotting T vs r
Try this: y=0.5; %magnitude of base motion zeta=1; %damping ratio wb=35; %base frequency k=4220000; %stiffness m=[13236 21...

6 years ago | 0

| accepted

Answered
Stripping only needed numbers from first line
Try this: first_line = 'jadud.dallaldlajksdofaihdfla 0lsudls nameherelaoudos 0.0 0.0 0.0 0.5 0.5 0.5 8 7 '; extract = regexp(...

6 years ago | 0

Load more