Answered
Interweave two arrays in a specific pattern
x = [1:160]'; y = x; xx = reshape(x,16,[])'; yy = reshape(y,16,[])'; zz = [xx,yy]'; z = zz(:);

4 years ago | 0

Answered
it's plotting empty figures
I made some adjustments. Let me know if this is close to what you want. tau = [1.5, 2]; figure for t = 1:length(tau) ...

4 years ago | 0

| accepted

Answered
Merging vectors into one
Simple: x = 1:10; y = x + 10; % for example % x and y are both [1x10] row vectors as you mentioned z = [x(:), y(:)]; % z i...

4 years ago | 1

| accepted

Answered
ECG spectrum wrong?
I'm not sure how you're doing your notch filters, but try this: Fs = 625; % or whatever your sampling frequency is. Fn = Fs/2;...

4 years ago | 1

Answered
How to avoid error when whether the function has returns is unknown?
You can use *nargout*(|Function|) to check the number of output arguments. <https://www.mathworks.com/help/matlab/ref/nargout.h...

4 years ago | 0

Answered
eval(sprintf('left = X+X%d+X%d+X%d+X%d+X%d+X%d', i==1:6)); throws error Undefined function or variable 'X0'. why
Forget about it. <https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically...

4 years ago | 1

Answered
Yet another "Dot indexing is not supported for variables of this type"
First of all, bravo for posting a very comprehensive question that is self-contained. Most people don't do this and it makes it ...

4 years ago | 1

| accepted

Answered
time series fatigue test
You can follow this example: lb = 5; % lower bound, ymin ub = 10; % upper bound N = 1000; % num samples vals = ran...

4 years ago | 0

| accepted

Answered
Dear fellows i am removing noise from( 3-200)HZ.
Let me link back to the previous time you asked this question, so other contributors can see the solution already provided. htt...

4 years ago | 0

Answered
Plotting continious-time signal
That's correct. You plotted three signals, with angular frequency of pi, 3/2*pi, and 2*pi rad/s. This corresponds to frequency o...

4 years ago | 1

| accepted

Answered
How to replace a string with another string in specific table columns
t{:,index} = regexprep(t{:,index},'\[\]','-99')

4 years ago | 0

| accepted

Answered
Cody question help: Remove all the words that end with "ain"
You are overcomplicating things. You have it with this expression regexp(s1, '\w*ain\>') But that just returns a set of indice...

4 years ago | 0

Answered
Non constant Sampling Frequency in FFT of Amplitude Modulation
Why do you want a non-constant sampling frequency? I don't understand the advantages of that, and there are plenty of disadvanta...

4 years ago | 0

Answered
storing for loop answer into matrix
It would often be much faster for you to just look up the documentation than to post a question here and wait for an answer. I s...

4 years ago | 1

Answered
How to display values from a chart into the command window
If you want the end value, then do coord = [x(end) y(end) z(end)] If you want the value when z = 0, assuming it equals e...

4 years ago | 0

Answered
Creating permutations of vectors using basic matlab commands such as loops.
You can do it in two lines of code by using *ndgrid*, and putting the four outputs column-wise into a matrix. That would be the ...

4 years ago | 0

Answered
Why is this fprintf not wprking correctly?
array = [studentNames;string(TotalAvg)]; fprintf('%s has an avg of %g\r\n',array);

4 years ago | 0

Answered
How to make a new stop in a vector when matlab reads a specific symbol?
help str2double help cell2mat

4 years ago | 0

Answered
Output argument "y" (and maybe others) not assigned during call
What is the function supposed to return for y = ycal(1,0,0)? It doesn't pass any of the conditionals in the if statement. And si...

4 years ago | 0

| accepted

Answered
Scatter doen not plot!
Put this line _outside_ the loop over |swarm.nb_drones|, or only the last iteration will be non zero. self.wake = zeros(10,...

4 years ago | 1

Answered
ECG spectrum wrong?
I'd say it looks fairly normal once you notch filter the line noise. But there is other preprocessing to do, like a low pass fil...

4 years ago | 2

| accepted

Answered
how can i make an array of frequency after doing fft which helps to identify the keypad number? i have included my script
You would have to calibrate each keypad to a specific frequency first, then compare what the user typed in to your calibrated pe...

4 years ago | 0

Answered
help me understand accumarray
OK, so the subs matrix represent the rows and columns of the matrix A. (1, 1) represent the first row and first column. (3, 2) r...

4 years ago | 1

| accepted

Answered
how to set limits of integration (for example: 0:inf) for a vector using trapz tool ?
Your vector of frequencies is not correct, because fft returns the negative frequencies first, followed by the positive frequenc...

4 years ago | 0

| accepted

Answered
how to produce multtiple stacked plots with different colors in a for loop?
You can use the power of colormaps (link) to do this. Here is an example: t = 0:0.001:1; figure col = jet(60); for k = 1:60 ...

4 years ago | 1

| accepted

Answered
Zooming a portion of figure in a figure
I just made some minor adjustments close all L = 0.01; R = 0.1; K_i = 800; K_p = [0.8, 1.2, 2, 4, 10, 40, 100]; figure...

4 years ago | 0

| accepted

Answered
Find duplicate entries and average them
% original data x = [0, 10, 20, 20, 20, 30, 40, 50, 50, 70]; y = [0, 10, 10, 20, 20, 30, 40, 50, 60, 60]; z = [10, 20, 40...

4 years ago | 0

| accepted

Answered
How to plot like the inserted picture?
You need to first collect all your values for yticks and labels, then set them all at once. For example nfiles = 10; for a = 1...

4 years ago | 1

| accepted

Answered
Time-frequency spectral coherence analysis
Have you looked at the MATLAB function mscohere? Otherwise, you could try looking into this function in the spm12 toolbox: spm_...

4 years ago | 0

Answered
i made a program that runs with the sound program but no sound comes out
The file is handel without a capital letter H. Same for gong. You can check the others. Once you load the file you have to play ...

4 years ago | 0

Load more