Answered
How do I trim a WAV file from point A to B.
You have the sampling frequency as an output from the audioread function. The time vector would typically go t = 0:1/fs:(length...

4 years ago | 0

Answered
Change axis from time to frequency
y is not a time series. Hz are not a unit of time. You cannot express something in the frequency domain as a function of time, b...

4 years ago | 1

| accepted

Answered
Array indices must be positive integers or logical values.
Here is a minimal working example of your problem x = rand(1,15); ind = 2*0.14/0.02+1; % occurs when s = 8 x(ind) Error: Ar...

4 years ago | 1

| accepted

Answered
A switch case statement that will help me to either run codeS in Windows or linux, based on whichever OS it is
if ismac % Code to run on Mac platform elseif isunix % Code to run on Linux platform elseif ispc % Code to run ...

4 years ago | 0

| accepted

Answered
Improve performance on finding max values of matrix
clearvars; % create fake data [y,x] = meshgrid(1:5); data = [rand(size(x(:))).*x(:),y(:)].*2; % different values of x (1st ...

4 years ago | 2

| accepted

Answered
Ploting Rayleigh faded signal copies
figure plot(t,real(sin1)) hold on plot(t,imag(sin1)) xlabel('Time') Or, using subplot figure subplot(2,1,1) plot(t,real(...

4 years ago | 0

| accepted

Answered
is it possible to convert iddata to cellstr
Close, but you need to access the *contents* of the cell array, not the entire cell array itself. data.y(:,1) = {rand(500,...

4 years ago | 0

Answered
grouping numbers in matrix
This is not a generalized solution, and assumes that there will always be three entries of each number (1, 2, 3) in A. [~,s...

4 years ago | 0

Answered
Hilbert transform with sine and cosine
The hilbert transform, as per the documentation, indicates that the imaginary part of the transform is the original (real) seque...

4 years ago | 0

| accepted

Answered
delete dimension based on user input
This should work. a = rand(4,3,2,5); % random 4D matrix dim = 3; % let's remove 3rd dimension numDims = 1:length(size(a)); % ...

4 years ago | 1

Answered
Outliers in a dataset
If x is also size 50x2, then you should pick a column to index as well. mx1_1 = mean(x(R1,1)); mx1_2 = mean(x(R1,2));

4 years ago | 0

Answered
How to change the color of the most recent plot point?
Consider the following idea: N = 10; cmap = parula(N); figure for n = 1:N plot(n,n,'o','Color',cmap(n,:)) ...

4 years ago | 0

Answered
I want to know how to speed up my for loop,it's a simple for loop.thanks
You don't need to do this in a loop at all. Here is how to vectorize the creation of the indices from 1:103, ..., 410:512. From ...

4 years ago | 0

| accepted

Answered
Undefined function or variable 'PrintSpaceTrussNodeCoordinate' error
Wherever you found this code, you need to download the associated functions with it. (Which I also said on the other question yo...

4 years ago | 0

Answered
Problems when creating matrix
The results are equal up to double precision. Look at this: max(abs(categ1-categ2)) % ans = % 2.22044604925031e-16 eps ...

4 years ago | 0

Answered
signal processing (segmentation )
If you want them sequentially, just put them back together using combinedSignal = [sig1 sig2 sig3]; % etc... sigN

4 years ago | 1

| accepted

Answered
Finding max amplitude from cosine
The maximum amplitude of F(t) = A*cos(w*t) where A = 1, will always be 1, for all values of w. This doesn't require use of ...

4 years ago | 0

Answered
vectors must be at the same length error
You are concatenating x and y into a doubly long vector. If you want to plot both signals, do plot(t,x,t,y)

4 years ago | 0

| accepted

Answered
Index 2D matrix along line rotated about the matrix midpoint
Here is another idea, perhaps you can play with it. You'll have to implement this in a loop. [cx,cy,c] = improfile(I,xi,yi,...

4 years ago | 0

Answered
display file function crash
try % some code here x = 1:5; for n = 0:4 y = x(n); % can't access x at position zero! end cat...

4 years ago | 0

Answered
What is the origin of this bus error?
Seems like you are running too many processes and ran out of memory. I've had this happen before and I just needed to limit my p...

4 years ago | 0

| accepted

Answered
Can only choose pi radians / sample in Passband frequency, not Hz.
_This toolbox uses the convention that unit frequency is the Nyquist frequency, defined as half the sampling frequency. The cuto...

4 years ago | 1

| accepted

Answered
Cell to 3D Matrix
mycell = repmat({rand(360,900)},20,1); % this is what you currently have mat3D = permute(cat(3,mycell{:}),[2 3 1]); ...

4 years ago | 0

| accepted

Answered
Creating multiple polar plot graphs for different frequencies
I'm writing the same thing here so this question can be answered. The issue is you are overwriting your variable f when you w...

4 years ago | 0

| accepted

Answered
How to overlay a plot onto a scatter plot?
You cannot plot vectors of different size. whos x y xtrue ytrue You'll see that x and y are 300x1, xtrue is 1x10001, an...

4 years ago | 0

| accepted

Answered
overlay mask on sequence of mri images to mark out tumor ROI
maskedImg = imgArray.*segment_mask; % segment_mask is size [256,256] % maskedImg is same size as imgArray [256, 25...

4 years ago | 0

| accepted

Answered
Simulink error: The data abscissae must be distinct and strictly monotonic.
None of the variables in the matfile are monotonic. all(sign(diff(Tga))==1) % ans = 0 all(sign(diff(Tm1))==1) % ans = 0 all(s...

4 years ago | 0

| accepted

Answered
How do I make heatmap axes order from bottom-top?
x = magic(10); figure imagesc(x) % notice the y-axis goes from 10-1 from bottom to top set(gca,'YDir','normal') % now it is r...

4 years ago | 0

Answered
Could anyone suggest me is there any way of choosing maximum and minimum values together
A = [23 42 37 18 52]; minmaxVals = prctile(A,[0 100]) ans = 18 52

4 years ago | 0

Answered
Generate a random signal in Matlab
y = (rand(10000,1) > 0.5)*2 -1;

4 years ago | 1

| accepted

Load more