calculate snr of digital signal
This is not correct. The second input to snr must be a real-valued row or column vector that must have the same dimensions as th...

2 years ago | 0

DTMF decoder .wav files code
It's a problem with your window size. Like I mentioned in a previous iteration of this question, you can look detect a proper wi...

2 years ago | 1

How do I generate a given Matrix in one command?
T = toeplitz([1 -1 0 0 0 0],[1 8 0 0 0 0])+diag(0:5)

2 years ago | 0

How to plot data with very small differences
You can try using *stem* or *scatter* or playing the *axis* limits. Or just plot the residuals, which is a pretty standard thing...

2 years ago | 0

Two outputs when calculating standard error of mean, WHY?
It's because size(A) returns two outputs. If you want to use the size of A in a particular dimension, use size(A,dim). (Since |s...

2 years ago | 0

| accepted

3d Plotting Using Meshgrid
Replace for i=1:1:length(n) for j=1:1:length(m) [X,Y]=meshgrid(i,j); %disp(f(X,Y)); mesh...

2 years ago | 1

| accepted

Switch the x axis direction where positive values are on the left side of the y axis
figure plot(1:10) set(gca,'XDir','reverse')

2 years ago | 0

how do I re-sample a continuous function; but maintain shape?
You can unaccept the answer if you want to keep it open, but also consider this answer. (For 3, I meant you're measuring from r...

2 years ago | 1

How do I organize repetitive values within a vector into a new vector that only has one of every repetitive value?

2 years ago | 1

Printing .m to pdf on Linux
publish('myscript.m','pdf'); It will publish any figure or anything that prints to the command line as well.

2 years ago | 0

how do I re-sample a continuous function; but maintain shape?
I see several potential reasons why this is occuring. 1) There will be general broadening of the signal due to downsampling. 2...

2 years ago | 1

| accepted

Random number, Random integer
x = 2:6; y = x(randperm(length(x),2));

2 years ago | 1

| accepted

mscohere function (equations used for it)
You can view the code by typing into the command window open mscohere % then subsequently open welch and follow along. You c...

2 years ago | 1

improving result of FFT
You'll want to use it as the second input to the fft. This will affect your frequency vector |fvec| though. n = 2^nextpow2(...

2 years ago | 0

What can I know from the spectrogram of mp3 and wav file
It's difficult to say given that they are plotted with two different colorbar axes limits. Set them to be the same and you can v...

2 years ago | 0

FFT size. Determine K so that K is a power of two
If you sampling frequency is 4000 Hz, then to get a resolution of 20 Hz you need to take an N-point fft, where N = 4000/20 = 200...

2 years ago | 2

How to get rid of ringing/overshoot in an ecg signal while using notch filter?
clearvars clc close all fs = 500; ecg = xlsread('Noisy_50HZ_ECG.xlsx'); ecg = detrend(ecg.'); ecg = sgolayfilt(ecg,0,5...

2 years ago | 1

| accepted

Multiple Summation of Series using For Loops (Magnetic Flux through Coil Simulation)
Hi Samuel, I don't see anything wrong with the code. The only thing I would change is to do the following outside the loops: ...

2 years ago | 1

| accepted

How to Take Inverse Fourier Transform?
You have essentially done this: Y1 = fftshift(fft(h38)); Y1 = abs(Y1); P1 = Y1; iP1 = ifft(P1); Of course iP...

2 years ago | 0

| accepted

collapsing redundant entries in MATLAB table
Use |groupsummary|: <https://www.mathworks.com/help/matlab/ref/double.groupsummary.html>

2 years ago | 1

| accepted

How to take gradient, curl or divergence of numeric vector fields?
You can use the |curl| and |divergence| functions which are not in the symbolic toolbox: <https://www.mathworks.com/help/matl...

2 years ago | 0

Random number multiple of 5 generation
First find out how many possibilities there are: interMin = 20; interMax = 150; n = sum(~mod(interMin:interMax,5)); % n = 27...

2 years ago | 0

Why won't my graph plot?
It did plot. Try this: plot(FS,d,'bo') It's just that FS and d only contain 1 element. You need to understand how to store da...

2 years ago | 0

How would you approach this problem?
I don't understand the second truth table, but the first one can be done as follows: actual = [0;0;1;1]; next = [0;1;0;1]; ...

2 years ago | 1

| accepted

How can I combine complex spectrogram results as an image for multi-channel EEG signal?
It usually takes a lot of work to get a figure to look just right. Here is what I came up with quickly, you can play around with...

2 years ago | 2

How can I combine complex spectrogram results as an image for multi-channel EEG signal?
Take all your outputs from spectrogram, and assuming they are all sampled at the same time/freqs, just stack them (concatenate) ...

2 years ago | 2

How to use the result of my matrix calculation to create 2D plot
l1,l2, and Z are all a single value. You need to understand how to store values in a for loop: https://www.mathworks.com/help/m...

2 years ago | 0

| accepted

time domain and frequency domain
Code looks fine to me. Not sure what you mean by N being 2^N. The only thing I would tweak is setting tvec = (0:N-1)*delt; As...

2 years ago | 0

extract data with unique ID
As Walter also suggested: [~,~,locGroups] = unique(subs(:,1)); % also look at [~,~,locGroups] = unique(subs(:,1),'stable'); ...

2 years ago | 0

| accepted