Answered
Sorting pairs into seperate matrices based on whether they are ascending or descending
The loop is not necessary anyway. Just use ‘logical indexing’ — pairs = [2 8 7 5 6 8 4 7 ...

2 years ago | 0

| accepted

Answered
I have line and want to colour the area behind the line (beyond the x axis) how can I do this
I am not completely certain what ‘behind’ the line means, however from your comments with respect to the x-axis, I guess that yo...

2 years ago | 0

Answered
Fit experimental data to analytical expression
Equation (3) is a bit mystifying to me. imshow(imread('analytical_expr.png')) imshow(imread('phase_vel.png')) I assume th...

2 years ago | 0

| accepted

Answered
Convert a datetime to string
I am not certain what the problem is. To convert [2022 07 17] to your desired format using datetime, try this — DT = dateti...

2 years ago | 0

| accepted

Answered
unexpected discontinuity in graphic
My guess is that the filter is unstable. This occurs relatively frequently with transfer function realiations of filters. I ...

2 years ago | 0

| accepted

Answered
exponential regression functions with error in input values
There are other options, however everyone hass fminsearch, so using it — x = [4; 25; 100]; y = [100; 50; 0]; % objfcn = @...

2 years ago | 0

Answered
3D surface plot from only scalars
The only difference appears to be that whatever produced the plots in the posted image is using much higher precision and differ...

2 years ago | 0

Answered
Question about a way variable appears
Functions have their own workspaces. Variables internal to a function will not appear in the ‘Workspace’ window because it only...

2 years ago | 0

Answered
Decoding geiger counter signal
If you want to divide the signal into non-overlapping segments and then analyse each segment, use the buffer function. That w...

2 years ago | 0

| accepted

Answered
How can I simplify this expression using "abs" function?
This seems to work — syms n k Expr = 7/6 * symsum((2*n^3 + 3*n^2 + n - 2*k^3 - 3*k^3 - k)-(k*(k+1)*(2*k+1))/6, k, 1, n-1) E...

2 years ago | 0

Answered
indexing error in function code
The initial subscript problem was the result of: y0=0; because there are 12 differential equations. There are several typogr...

2 years ago | 0

| accepted

Answered
Why my - tf2sym - command is not working?
If you want to conovert that transfer function to a symbolic variable, try this — Gs=tf(1,[1 10 27 18]); Gss= tf2sym(Gs) w...

2 years ago | 0

Answered
Running example "Create Site Viewer" does not work in Matlab R2023b
Apparently, in the interest of reducing the increasing storage demands of the more recent MATLAB releases, MathWorks has stopped...

2 years ago | 0

Answered
Can you answer why am I getting this error. What should Ido? The error says 'Unrecognised variable z'.
The first if block condition is not being satisfied, so ‘z’ is not defined. The reason is easy to see, since any absolute va...

2 years ago | 0

Answered
How do I find the specific X-coordinates where y is equal to a specific value?
We do not have your data, however what you want to do is straightforward. Try this — freq = linspace(0, 10); y = mag2db(no...

2 years ago | 1

| accepted

Answered
How can I just change the color of the bottom x-axis of a figure?
If you just want to change the axis colour, try something like this — Ax1 = axes; Ax2 = axes; Ax2.XAxisLocation = 'top'; Ax...

2 years ago | 0

Answered
Revolve a Plot around y axis to generate a 3D plot
The easiest way to do this is to start with the sphere function and then scale it. Try this — theta =linspace(-pi/2,pi/2,10...

2 years ago | 0

Answered
How to only change the sign without altering the font?
When I copy the sign from Windows Character Map and then explore it, your approach seems to work — figure plot([-10:-1]); % ...

2 years ago | 0

Answered
How to find phase and frequency spectrum of signal?
A one-sided fft — t = -2:0.01:2; x = zeros(size(t)); x(t >= -2 & t < -1) = -1; x(t >= 0 & t <= 2) = -1; figure plot(t, ...

2 years ago | 0

Answered
Daily and monthly moving averages
Use a timetable rather than a dataset. Then use the retime function.

2 years ago | 0

Answered
Keep getting ERROR: Array indices must be positive integers or logical values for X(t)
Create ‘X’ as an anonymous function: X = @(t,C,Wd,Phase_Angle) (C.*exp(1).^-del.*Wn.*t).*cos ((Wd.*t)-Phase_Angle) % equation ...

2 years ago | 0

Answered
In the case of a previously filtered signal, what methods can be employed to identify its filter characteristics?
If you have the original signal as well (before filtering), you can approximate the filter transfer function by taking the Fouri...

2 years ago | 1

| accepted

Answered
Finding the slope after drawing a trend/linear fit
Alternatively — files = dir('*.xlsx'); T1 = readtable(files.name) VN = T1.Properties.VariableNames; T = T1.T; x = T1.x; ...

2 years ago | 0

| accepted

Answered
How can I align deterministic signals?
Probably the easiest way to do this (with these signals) is simply to threshold the beginning of each to get the index, then use...

2 years ago | 1

| accepted

Answered
solve by the matrix method
Solving it symbolically — syms x1 x2 x3 x4 Eqns = [x1+2*x2-x3+x4==28 2*x1+4*x2-3*x3+x4==55 -4*x1+8*x2-12...

2 years ago | 0

Answered
if loop for checking package weights and to calculate shipping costs
Try this — for package = [1 25 50 75 110] package % Package Weight In Loop (D...

2 years ago | 1

| accepted

Answered
How can I display axis ticks when using fill syntax?
The easiest way is to bring the ticks to the top layer — x = linspace(0, 1).'; y = x; figure fill([x; flip(x)], [zeros(si...

2 years ago | 1

| accepted

Answered
Calculate median values of slices of array associated with histogram bins
I would use another accumarray call: binmedians = accumarray(idx+1, (1:numel(idx)).', [], @(x)median(array2(x))) Creating d...

2 years ago | 0

| accepted

Answered
How can I add a horizontal dashed line with a text description above it to a specific coordinate?
Perhaps this — t = linspace(0, 5); k = 0.75; y = 5*(1-exp(-k*t)); yval = 3; tval = interp1(y, t, yval); figure plot(...

2 years ago | 0

| accepted

Answered
remove DC component of real time signal
The D-C component is the mean of the signal, so for a recorded signal, simply subtract the mean. Otherwise, since the D-C off...

2 years ago | 0

Load more