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

Answered
Error: using fmincon and integral: Failure in initial objective function evaluation. FMINCON cannot continue
The ‘rhog’ variable must be defined in your workspace prior to using it as a function argument in ‘q’. EDIT — (14 Nov 202...

2 years ago | 1

| accepted

Answered
Factor P(x) with a degree of 4
One way to find out — syms x P = 5*x^4+3*x^3-6*x^2+x-4 x = vpa(solve(P)) x_real = x(imag(x)==0) x = vpa(root(P)) x_rea...

2 years ago | 0

Answered
How to Plot Inverse Laplace with Heaviside?
Use the fplot function — clc syms s t Q = 10/(s*(s^2+100*s+1600))-10*exp(-3*s)/(s*(s^2+100*s+1600)); pretty(Q) q = ila...

2 years ago | 0

| accepted

Answered
Given an audio file, how can I construct a histogram of all bipolar pulses?
The findpeaks function can easily detect negative peaks. Simply negate the original signal to get them — t = linspace(0, 50...

2 years ago | 2

| accepted

Answered
how to calculate integral for combination of columns
One approach — T1 = readtable('ET1.xlsx', 'VariableNamingRule','preserve') [G,ID1,ID2,ID3,ID4] = findgroups(T1(:,1), T1(:,2...

2 years ago | 0

| accepted

Answered
How to plot a surface with lat, lon and depth?
You will need to create a matrix from your data vectors. (It would help to have the actual data.) Assuming they are similar ...

2 years ago | 0

Answered
Add Text Tile to Tiled Layout
One approach — x = 0:99; y = randn(3,100); figure tiledlayout(2,2) for k = 1:3 nexttile plot(x, y(k,:)) g...

2 years ago | 0

| accepted

Answered
How can I use histfit function?
Your data are frequency data (probably the result of performing a histogram on an original data set), not actual histogram data....

2 years ago | 0

Answered
How to interpret the frequencies on a symmteric FFT plot.
You need to use the fftshift function to put the zero frequency (D-C or constant offset) value in the centre. Then, depending o...

2 years ago | 0

| accepted

Answered
How to find the coordinates of contours when they go out of bounds and form multiple contours?
Here is my approach to this — load('contours.mat') pk = -32; [c2] = contourf(x2,y2,z35b, [pk pk] ,'ShowText','on',FaceAlpha...

2 years ago | 0

| accepted

Answered
How to combine columns from large dataset to datetime with correct vector or doublestring?
Use curly brackets {} instead of parentheses when referring to numbered table variables — Date=datetime(dataTable{:,3:5})+hour...

2 years ago | 0

| accepted

Answered
How can I selectively multiplying the negative values with (-1) in an excel file?
Multiplying the negative values of column 2 by -1 will of course create them as positive values for all the entries. Use the ...

2 years ago | 1

Answered
How to estimate Y using a linear regression and an uncertain X value.
If I understand corectly what yoiu want to do, the best approach might be to use fitlm and then use the appropriate predict func...

2 years ago | 0

| accepted

Answered
Why does expm command work too slow?
If you want to multiply it by scalar or vector ‘t’, create an anonymous function rather than doing it symbolically — A_aug = r...

2 years ago | 1

Answered
How to draw a semi circle filled with jet color (like in the image) ?
Try this — N = 250; th1 = linspace(pi, 3*pi/2, N); r = linspace(0, 1, N); z = r; x1 = r(:)*cos(th1); y1 = r(:)*sin(th1)...

2 years ago | 0

Answered
Time-dependent parameter in ODE solver
The interp1 use in the documentation section for time-dependent parameters refers to vector arguments with a dependent variable ...

2 years ago | 0

| accepted

Answered
Connecting different sets of 3D points
I assume the rows are the (x,y,z) coordinates, If so, try this — A_3Dpts= [-0.91, 0.53, 0.32; -.88, .51, .3; -.84, .43, .16...

2 years ago | 1

| accepted

Answered
How do I perform several iterations in MATLAB?
Since ‘y’ appears to be a column vector, the loop is not necessary. Just use: L = 1.56*(y.^2)*tanh(61.58/L); If you are loo...

2 years ago | 0

| accepted

Answered
How do i find x from given y that is closest to my peak or at x=0?
One approach — x = linspace(-10,10,500); y = 1 - x.^2; L = numel(x); yval = -6; zxi = find(diff(sign(y -yval))); for ...

2 years ago | 0

| accepted

Answered
Symbolic function Gaussian Beam
You need to use element-wise operations. See the documentation on Array vs. Matrix Operations for details. Also, you can use...

2 years ago | 0

Answered
Using repelem to vertially concatonate non-numeric variable
I am not certain what you want to do, however the repmat function might be a better choice, since it allows the dimensions to be...

2 years ago | 1

| accepted

Answered
Is using alphabetical characters in the area (x,y) syntax possible?
‘Is using alphabetical characters instead of numeric arguments as x-variables in the area (x,y) syntax possible?’ Yes, in the...

2 years ago | 0

Answered
How to plot Rankine Half Body Streamlines
I can’t run that because the relevant data aren’t provided. Tha atan calls could be the problem. Substituting‘atan(y/x)’ with ...

2 years ago | 1

Load more