Answered
How can I speed up iterating through two large nested for loops and subtracting one array from another?
*_If I understand correctly what you want to do,_* that is to subtract the mean of *|‘data’|* across dimension *|1|* from *|‘dat...

9 years ago | 0

| accepted

Answered
How do I find the x value from a graph at y = 37?
Use the <https://www.mathworks.com/help/matlab/ref/interp1.html *|interp1|*> (link) function: x=linspace(0, 100, 100); ...

9 years ago | 1

| accepted

Answered
Reading a textfile without removing leading zeros
If you want to retain the leading zeros, you have to read them in as strings: filename = 'NWISMapperExport.txt'; fidi =...

9 years ago | 0

| accepted

Answered
How can I replace values in an array with the value in the previous column's value?
Try this: n(1,:) = [0 0 0 0]; %create a matrix with four elements L = numel(n); for k1 = 2:10 msrd_dist = ran...

9 years ago | 1

Answered
plotting a beat frequency
You need to tweak your function just a bit, changing *|sound|* to *|soundsc|*, and add the sampling frequency to it as the secon...

9 years ago | 0

| accepted

Answered
How do I plot a function that has a value given
Since you did not post your code, I cannot help you troubleshoot it. Two options — Symbolic: syms x DRatio = ...

9 years ago | 0

Answered
how do I replace zeros
Address *|16|* of the elements of *|‘x’|*: x = zeros(1,17); % this is my initial vector of zeros x(1:16) = round(200 + ...

9 years ago | 0

Answered
extract data from matrix and store into a new matirx
You do not need the loop. This works: data = test([6 end],:); data = 30 10 60 7

9 years ago | 0

| accepted

Answered
Logical indexing: Find row in table by text in column
To compare strings use the <https://www.mathworks.com/help/matlab/ref/strcmp.html *|strcmp|*> (link) or *|strcmpi|* function: ...

9 years ago | 6

| accepted

Answered
How to generate 20 unrepeated random integers with in a range of 1 to 100
Use the <https://www.mathworks.com/help/matlab/ref/randperm.html *|randperm|*> (link) function: v = randperm(100, 20); ...

9 years ago | 2

Answered
Compare two tables with two column combinations
If I understand what you want to do, this will work: Lv = ismember(t2, t1, 'rows'); DesiredRows = find(~Lv) Desi...

9 years ago | 2

Answered
How to filter a low frequency movement from my data
This uses a highpass Chebyshev Type *|II|* filter to eliminate the low frequency variation and the c-d (constant) offset from bo...

9 years ago | 1

| accepted

Answered
To find amplitude and phase in FFT
First, do the <https://www.mathworks.com/help/releases/R2015a/matlab/ref/fft.html *|fft|*> (link). Then use *|abs|* to find...

9 years ago | 0

Answered
How to show the value of sym in workspace?
I am not certain what you are asking. One option is to assign it to a variable: syms u Uint = int(u-1,0,1) ...

9 years ago | 0

Answered
How would I go about plotting an ellipse?
Another approach using <https://www.mathworks.com/help/matlab/ref/isosurface.html*|isosurface|*> (link): elpsfcn = @(x,y,...

9 years ago | 0

| accepted

Answered
How do I plot 2 surf plots in the same figure
Use the <https://www.mathworks.com/help/matlab/ref/hold.html *|hold|*> (link) function. figure(1) surf(X,Y,Z1) hold...

9 years ago | 0

| accepted

Answered
Error: The expression to the left of the equals sign is not a valid target for an assignment.
If you want a numerical result, vectorize it and then use *|integral|*: qz = vectorize('(25/4*(2*tan(z/2)*tan(z/2)-z*sec(z...

9 years ago | 0

| accepted

Answered
I would like to evaluate a partial sum for N=3,N=10,N=25 and at the same (or any N). How can this be done?
One approach: N =[3 10 25]; X=pi/2; n = 1:max(N); v = cumsum( (((-1).^n)./n) .* sin(n*X) ); Out = arrayfun(@(x...

9 years ago | 0

Answered
invalid syntax at '=' at line 10
The problem is not Line *|10|*. It _is_ that Line *|9|* does not have a closing square bracket. Change Line *|9|* to: ...

9 years ago | 0

| accepted

Answered
Remove trend and detect peaks in a photoplethysmogram(PPG) signal
If you want to eliminate the baseline wander and offset, change to a highpass filter with a different cutoff frequency: wn...

9 years ago | 2

| accepted

Answered
trying to plot a frequency and harmonics with symsum but not ploting anything
This will plot it although the plot is not at all interesting. syms k; fs = 100E+6; f = 3.3E+6; Ts = 1/fs; ...

9 years ago | 0

Answered
Failure in initial objective function evaluation. FSOLVE cannot continue.
You have to choose between coding them as: function y = eita(x, alpha) y(1) = 1.543E-5 * x + 0.57; y(2) = (4...

9 years ago | 1

| accepted

Answered
Substitute different values of variance into a polynomial and create an excel profile
To create the polynomial, do this: [a,b] = meshgrid(1:10); y = a + 2.*b.^2 - 3.*a.*b; % Desired Re...

9 years ago | 0

| accepted

Answered
how can i remove this error "not enough input arguments". Any help please
We would have to know how your call your *|‘lab1_x1’|* function. However, you have not defined within *|‘lab1_x1’|* either ...

9 years ago | 0

Answered
Why doesn't this command work (vector addition)?
You are defining *|‘y’|* as a vector. In MATLAB, subscripts are defined as _integers_ greater than zero. So this will not ...

9 years ago | 0

Answered
about freqs_m function
You have to download <http://www.codeforge.com/read/252939/freqs_m.m__html *|freqs_m|*> (link) from Code Forge.

9 years ago | 1

Answered
Why is my plot not showing anything?
Try this: figure hold on axis([-5, 5, -5, 5]) plot(3,4,'pg') The default *|plot|* behaviour is to plot a line ...

9 years ago | 4

| accepted

Answered
Problem with dimensions using meshgrid
You need to vectorise *_every_* multiplication, division, and exponentiation: z = (-4.3461.*(10.^-7)).*[1./[1 + ((x.^2)./(...

9 years ago | 0

| accepted

Answered
Help creating a function
I would create them as <http://www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html *Anonymous Functions*> (link)....

9 years ago | 0

| accepted

Answered
Formatting Output - Answer remains in fractional form but want a decimal approximation!
Use the <https://www.mathworks.com/help/symbolic/vpa.html *|vpa|*> (link) function for a symbolic result or the <https://www.mat...

9 years ago | 3

Load more