Answered
How can I use my own function to optimize using fminunc?
In the optimization routines, the parameters you want to optimise have to be in a single vector. In this instance, simply chang...

9 years ago | 0

| accepted

Answered
I'm plotting ECG data and I want to resale the x and y axis so that only the first 3 seconds are showing
First, you need to know the sampling frequency of your EKG record. You can either have that stated in the metadata of the recor...

9 years ago | 0

| accepted

Answered
Fast Fourier Transform from data in file
Try this: L = length(file); % Signal Length t = linspace(0, 1, L)*33E-12; ...

9 years ago | 1

| accepted

Answered
Calculate linear interpolation of a vector
If you actually want to interpolate, this works: X = [4 0 0 0 0 0 0 8]'; Xnz = X(X ~= 0); ...

9 years ago | 1

Answered
How do I find Peaks in Plotted data?
Using *|findpeaks|* is the correct approach. You need to reverse the arguments to get the result you want. Try this: ...

9 years ago | 2

Answered
Do FFT results need to be scaled if the chebwin MATLAB function is used to window the data?
It is generally not necessary to adjust anything as the result of using a window. However there are two errors in your code...

9 years ago | 0

| accepted

Answered
Need help computing average time for a code I made
That should work. You can also use the *|mean|* function: for i = 1:10 tic someCode t(i) = toc; ...

9 years ago | 0

Answered
Plotting sine wave.
The ‘negative cycles’ take care of themselves, since the sine and cosine curves will go from *|+5|* to *|-5|*, unless there is s...

9 years ago | 0

Answered
Fitting linear log regression with fitlm function
Try this: mdl = fitlm(log(x), y); It assumes a linear model (slope and intercept), so this is all that is necessary. ...

9 years ago | 1

Answered
Why my graph window is blank?
You have to plot a marker if you are plotting single points in a loop. Try this: plot(core_diameter, result, 'pg') ...

9 years ago | 0

| accepted

Answered
Interp1 - The grid vectors must contain unique points
My usual approach to the problem of non-unique independent variable values for *|interp1|* is to add a very small, increasing va...

9 years ago | 0

Answered
how can I fix this error of Local minimum possible. lsqnonlin stopped because the size of the current step is less than the default value of the step size tolerance. <stopping criteria details>
It’s not an error. It just means that *|lsqnonlin|* likely reached a minimum (either local or global), and stopped. This occur...

9 years ago | 0

Answered
How do I convert a char into a double with non-ascii values? I need a to equal 1 not 97
This sounds like homework. Consider using the *|char|* and *|double|* functions to get where you want to go. It would ...

9 years ago | 0

Answered
Find Minimum based on new criteria
This works: row = (A(:,3) == min(A(A(:,5)==1,3))) & (A(:,5) == 1); % Row Index (Logical Vector) Result = A(row,:) ...

9 years ago | 0

| accepted

Answered
No line on my graph
You need to vectorise (do element-wise calculations) in your *|‘modz’|* calculation. This means substituting |‘./’| for |/|: ...

9 years ago | 0

Answered
How to change the parameters of step function?
Using <https://www.mathworks.com/help/control/ref/stepdataoptions.html *|stepDataOptions|*> (link) you can change the amplitude ...

9 years ago | 0

| accepted

Answered
How to find value of X if i know Y value
Assuming that *|‘y’|* is monotonically increasing or decreasing (not oscillating), one approach would be: xv = interp1(y, ...

9 years ago | 0

| accepted

Answered
Memory leak from waveform plotting at high frequency
I don’t see the problem. f = (200 : 0.5 : 245)*1E+6; t = 0 : 0.01 : 1; y = sin (2 * pi .* f(:) * t); whos y...

9 years ago | 0

| accepted

Answered
how to crreate an array
Try this: x=[1 0 1]; N = 10; Output = reshape(repmat(x(:)', N, 1), 1, [])

9 years ago | 0

| accepted

Answered
Surf plot: Data dimensions must agree.
Either *|‘transect1.lon’|* or *|‘transect1.lat’|* has to be *|(30x1)|*, or you have to remove one _column_ from *|‘transect1.z’|...

9 years ago | 0

| accepted

Answered
Find max gradient in a slope
The <https://www.mathworks.com/help/matlab/ref/gradient.html *|gradient|*> (link) function assumes a constant step in each direc...

9 years ago | 0

Answered
how to solve a system of nonlinear differential equations
Most nonlinear differential equations do not have analytic solutions. Yours appear to be among them. Try this: syms ...

9 years ago | 0

Answered
Plot a cyinder with height from one value to another
I can’t determine if this is a homework assignment or not. The plot is straightforward: r = 2; t = linspace(0, 2*p...

9 years ago | 0

| accepted

Answered
I want a code that convert EKG BW signal from time domain into frequency domain ?
I would use the <https://www.mathworks.com/help/releases/R2015a/matlab/ref/fft.html *|fft|*> (link) function.

9 years ago | 0

Answered
Display date data on x-axis
The easiest approach is likely to use the <https://www.mathworks.com/help/matlab/ref/datetick.html *|datetick|*> (link) function...

9 years ago | 0

| accepted

Answered
Inconsistent looping issue with trapz()
The computations for *|‘TA’|*, *|‘Tb’|*, *|‘xa’|*, and *|‘xb’|* don’t change w.r.t. the loop parameters, so it’s safe to evaluat...

9 years ago | 0

| accepted

Answered
how make bandpass filter using fdatool perfect for IIR and for FIR ? for fs= 360 . thank you
As of *|R2016b|*, *|fdatool|* is called <https://www.mathworks.com/help/signal/ref/filterdesigner-app.html *Filter Designer*> (l...

9 years ago | 0

Answered
How to use state space matrix to calculate response with inputs
Use the *|lsim|* function: sys = ss(A,B,C,[]); t = linspace(0, 6) u(1,:) = exp(-t); u(2,:) = cos(t); [y,...

9 years ago | 0

Answered
How to store values from an ode solver?
This works for me: function dFdt=membrane(t,f) k=0.05; %specific rate constant kt=0.3; %transport coefficient ...

9 years ago | 0

| accepted

Answered
How do i get the Nyquist frequency from FFT and PSD?
You do not get the Nyquist frequency from the plot, you calculate it from the data. The Nyquist frequency is half the sampl...

9 years ago | 1

| accepted

Load more