Answered
How to integrate area under peak?
Try this: D = load('data for peak area.txt'); idx = D >= 0.28; chg = [find(diff(idx ~= 0)); numel(D)]; chg(1) = 1...

9 years ago | 1

| accepted

Answered
set fundamental to 0dB using snr
Dividing *|‘x’|* by *|‘max(x)’|* is probably as close as you can get: xs = x/max(x); figure(1) snr(xs, Fs, 5) ...

9 years ago | 0

| accepted

Answered
How do I delete rows from a matrix based on the number of the row.
Assign the rows that need to be deleted to the empty array *|‘[]’|*: A = [ 15 2 4; 19 3 7; 12 2 6; 10 4 9] BadA= [ 1; 3...

9 years ago | 0

Answered
Using a array in a equation that has a variable being isolated.
Try this: g=9.8; h=[0.1:0.1:1]; v=sqrt(2*g*h); vy=v*sind(45); vx=v*cosd(45); %defining t %yp=vertica...

9 years ago | 0

Answered
Finding equation of a line in R^3
Without knowing what your function actually is, fitting it to your data is not possible. A _linear_ fit is straightforward:...

9 years ago | 0

| accepted

Answered
Linear Combination Analysis help
One possibility: k = 4.2; % Define ‘k’ t = linspace(1, 4*pi); Sa = si...

9 years ago | 0

Answered
Write a program that will find the smallest number that is divisible (without remainder) of each of the numbers 1 to 10.
Since ‘remainder’ is the important requirement, search the <https://www.mathworks.com/help/matlab/index.html *MATLAB*> (link) on...

9 years ago | 0

Answered
I want to calculate AUC score by using trapz function , integrating across rows. My matrix has dimension (180*10). So, There should be a table with 180 rows a and one column of AUC scores.
To repeat: From the documentation: * |Q = trapz(___,dim)| integrates along the dimension |dim| using any of the previous...

9 years ago | 0

| accepted

Answered
Find X and Y using matlab
Use *|fsolve|* and a bit of algebra: f = @(x,y) [y.^2 - x; 2.*y-x.^2 + 2]; XY0 = [1; 1]; XY = fsolve(@(b) f(b(1),b(2...

9 years ago | 0

Answered
How to integrate across row values?
From the documentation: * |Q = trapz(___,dim)| integrates along the dimension |dim| using any of the previous syntaxes. ...

9 years ago | 0

| accepted

Answered
[Errorbar plot] How to set letters/word on x axis properly?
You didn’t post ‘all the supplied names’ or other details, so writing specific code for your problem is not possible. Adapt...

9 years ago | 2

| accepted

Answered
Plotting plain grid of size 100 X 100 AND selecting a "block" in the grid
Try this: figure(1) plot([0:100; 0:100], [0:100; 0:100], 'k') hold on fill([0 1 1 0]+50, [0 0 1 1]+50, 'r') ...

9 years ago | 0

| accepted

Answered
Solving equations with different ranges
Using ‘logical vectors’, *|‘P’|* is not defined for *|‘S’|* greater than or equal to *|‘Lf/2’|*, so an explicit condition for th...

9 years ago | 1

| accepted

Answered
Lowpass Filter with Linear Units
The ‘decibel’ calculation simply converts amplitude to power, and scales it logarithmically. It is convenient with respect to p...

9 years ago | 0

| accepted

Answered
How do I print the following for loop as A1, A2, A3, A4?
Use *|fprintf|* or *|sprintf|*. Try this: for i = 1:4 fprintf('A%d\n', i) end

9 years ago | 0

| accepted

Answered
Restricting a vector size
Try this: a = [1 2 3 4 5 6 7 8 9 10]; Out = a(a >= 2 & a <= 6);

9 years ago | 0

| accepted

Answered
How to Integrate a vector?
To integrate a vector, use the <https://www.mathworks.com/help/matlab/ref/trapz.html *|trapz|*> (link) or <https://www.mathworks...

9 years ago | 3

| accepted

Answered
How to solve the error in the following code ''Index Exceeds matrix dimension"?
You need to reverse the index assignments: for i = 1:nz for j = 1:nt G(i,j) = 5-(3*cos(X(i,j)/50)); %#ok...

9 years ago | 0

| accepted

Answered
Undefined function 'minus' for input arguments of type 'function_handle'.
My _guess_ is that this assignment (and others like it in your code) are throwing the error: P_out_AC =@(m_w2) wInP - PD_I...

9 years ago | 1

Answered
fminsearch for multiple variables. HELP!!!
You have not defined *|‘n’|* and *|‘m’|* prior to this assignment: y = ln(dAdT./((1-A).^n.*A.^m) ); that also is coded ...

9 years ago | 1

| accepted

Answered
How can i make a smoothed envelope of my complex (random) signal?
The <https://www.mathworks.com/help/signal/ref/envelope.html *|envelope|*> (link) function uses the absolute value of the <https...

9 years ago | 1

| accepted

Answered
how to remove spikes from the signal.
I am not certain what you want as a result. This will eliminate ‘spikes’ greater than *|10|* above than the detrended signa...

9 years ago | 0

| accepted

Answered
nlinfit for a function of 2 variables
It looks to me that you have coded your *|‘gaussian’|* function correctly. (I’ve used this approach successfully with *|nlinfit...

9 years ago | 0

Answered
Power Spectral Density Unit Conversion
I am not certain what the units of ‘pm’ are. To convert dB (as power) to amplitude, this little anonymous function works: ...

9 years ago | 0

Answered
Please help me to check my code
Try this: myfunc = @(w,n) 1./(9.*(w.^n)-8.*w); u=[4:1:10]; n = some vector; for iu=1:length(u) ...

9 years ago | 1

Answered
Problem of calculating the value of integrals
One problem is that this term: cl2 = int(-log(abs(2*sin(0.5*y))), 0, 20*x); will evaluate to *|+Inf|* at *|0|*. I ...

9 years ago | 0

| accepted

Answered
How to make a matrix of my own dimensions and contents?
One approach: r = 96; c = 577; M = (4.7153 + 2.8412) * rand(r,c) - 2.8412;

9 years ago | 0

| accepted

Answered
Floating-point scalars
I am not certain what you want to do, so I’m taking my best _guess_ at it. This runs: Lf=12; E=22000; rou=1.2; ...

9 years ago | 0

Answered
what will be code for solve this equation : t(a+b/i)+t^2(c+d/i)+t^3(e+f/i)+t^4(m+n/i)=k; where t is unknown, "i" has a range 1:10, and all other are known constants .
The easiest way would be to use the *|roots|* function in a loop: [a,b,c,d,e,f,m,n,k] = deal(2,3,5,7,11,13,17,19,23); ...

9 years ago | 1

| accepted

Answered
Storing values from function in loop
I don’t see where your *|‘TotalRun’|* variable is defined in the code you posted. I would index it in the array: Tota...

9 years ago | 0

Load more