Answered
Genetic Algorithm and objective function value
If the objective funciton is the same as the fitness function (and I have no idea what you are doing), the result should be the ...

4 years ago | 0

| accepted

Answered
How to know the passband of the savitzky golay matlab filter?
The Savitzky-Golay filter is not a discrete filter in the usual sense, and while all digital filters work best with uniformly-sa...

4 years ago | 0

Answered
Generating random angles between interval
Try something like this — random_angles3 = rand(1,3)*2*pi - pi random_angles1000 = rand(1,1000)*2*pi - pi; figure histo...

4 years ago | 0

Answered
How to add zoom box to matlab plot??
See the axes documentation section on Position Multiple Axes in Figure.

4 years ago | 0

Answered
How to apply any 2D lines on to a given 3D surface?
This is actually straightforward with the griddedInterpolant function, providing the data are gridded to begin with. The surfac...

4 years ago | 0

| accepted

Answered
flushing the keyboard input after a pause.
I generally do not use input, preferring inputdlg instead.

4 years ago | 1

| accepted

Answered
How can I a function on the interval
If you want the x and y values, you need to ask for them — f = @(x)x+log(x) hfp = fplot(f,[0.1 1]); x = hfp.XData y = hfp...

4 years ago | 0

Answered
I keep getting an error?
It may be necessary to use the cell2mat function if the arrays are in a cell array. The existing cell array elements must be pu...

4 years ago | 0

Answered
how to write values with dms2degrees
This is a real challenge. There must be an easier way to do this, however if there is, it eludes me. I wrote my own functi...

4 years ago | 0

| accepted

Answered
Why does this happen when using the log scale for the y-axis?
Setting the BaseValue parameter to a positive value is an option. All the bar heights appear to be positive.

4 years ago | 1

| accepted

Answered
I am trying to plot this
Try this — t = linspace(0, 2*pi, 1E3); % Time Vector x = 1:2:31; ...

4 years ago | 0

Answered
How do I code rearrange equation?
Use the isolate funciton. (The solve function is also an option.) syms a t v_0 x_t x_0 Eqn = x_t - x_0 == v_0*t + a*t^2/2 ...

4 years ago | 0

Answered
Fail to unzip .gz file using 7zip in Matlab
I’m not certain what you want to do. MATLAB has the built-in unzip and gunzip functions that I use frequently, especially her...

4 years ago | 0

Answered
Improving first coding project
I deleted my answer because the other one was upvoted, meaning that in all likelihood, since the other is so long, even though I...

4 years ago | 1

Answered
Time approximation in matlab
If the sampling interval was constant: SamplesPerHour = 1500/24 Otherwise, you could use the retime funciton with the interva...

4 years ago | 0

Answered
Trying a overlapping but piecewise plot
The problem description leaves much to the imagination. If you want to offset them on the x-axis, this likely requires a loop. ...

4 years ago | 0

| accepted

Answered
Trying to change the y axis range in fplot
See if ylim will do what you want — syms s a b c d e f n10 = a + (b*s) + c*(s^2) + d*(s^3) + e*(s^4) + f*(s^5) n10_d1 = diff...

4 years ago | 1

| accepted

Answered
How to extract labels from a xlsx graph in matlab
It depends how you’re importing the Excel file. If you use readtable, the header line (assuming only one) will be ‘VN’ in: T...

4 years ago | 0

Answered
How would I find the median RR interval in an ECG signal?
Perhaps this — Fs = 500; t = linspace(0, 100, 100*Fs)/Fs; EKG = randn(size(t)); [pks, locs] = findpeaks(EKG, 'MinPeakProm...

4 years ago | 1

Answered
Why am I receiving three outputs for this lsim function?
You’re actually receiving four, one for each state. However if you create a system object out of the matrices first, you only...

4 years ago | 0

Answered
How can I get x-y values for a given z coordinate from a 3d surface plot?
You can use the find function to get the index coordinates of the point (it may require creating a tolerance, since the value yo...

4 years ago | 0

Answered
Interpolation from a table
The interp2 function is one option — eb = [0 0.25]; yb = [0.5; 0.75]; K0 = [1.0009 1.3767; 0.9948 1.5583]; Check = [N...

4 years ago | 0

Answered
indexing through array in for loop
What function are you using to estimate the statistic? I don’t see any built-in MATLAB functions for it, although I may be loo...

4 years ago | 0

Answered
Can i pass an array of n strings to a function that takes n strings as input?
The plot calls should probably be referencing ‘i’ instead of ‘n’ and if you have R2016b or later, you can use string arrays — ...

4 years ago | 0

Answered
Error using patch not enough input arguments
The 'FaceColor' name-value pair is not necessary in patch calls. Just use the designated colour or RGB triplet as the third arg...

4 years ago | 0

| accepted

Answered
Differential equation unable to find a symbolic solution
The equation is nonlinear in , and dsolve will not solve nonlinear differential equations. Integrating it numerically gives —...

4 years ago | 0

| accepted

Answered
How to perform summation of the given equation?
The ‘dz’ may mean the function is an integrand — syms z H = sym(10); k(z)=(15/2)*(H-z)*(sin(30)); K = int(k, z, 0, 10) K ...

4 years ago | 0

| accepted

Answered
How can I produce a plot like the one in the picture using quadratic equation in MATLAB?
I have no idea what the picture demonstrates. Perhaps something like this — a = randn b = randn c = randn r = roots([a b...

4 years ago | 1

Answered
Envelope function of a signal
Use the envelope function. t = linspace(0, 1, 1E+3); s = sin(2*pi*t*5) .* sin(2*pi*t*100); [senvu,senvl] = envelope(s, 10...

4 years ago | 0

| accepted

Answered
Variable "Flag" is not fully defined in some execution paths. Why?
Because there are conditional statements in the code, and not all of them set the ‘Flag’ variable. One way to avoid that is t...

4 years ago | 1

Load more