Answered
Iterations until condition is met
It is because of the accuracy of floating-point operations. Instead of checking if (1/M) * ((2/(gamma+1))*(1+((gamma-1)/2)*(M^...

3 years ago | 0

Answered
How to repeat a vector over and over?
Here is one way: % Inputs (for example small enough to easily see the result) N = 7; v = [2 3 5]; % Algorithm vlen = nume...

3 years ago | 1

Answered
Inconsistent dimensions of arrays
Note what the upper-left element of your array is: theta=0:0.01:2*pi; cos(theta) So, you are trying to concatenate two rows t...

3 years ago | 0

| accepted

Answered
Find the indicies of the top 250 values of a Matrix
[Sorry if you saw the incorrect solution I posted and then deleted.] If you want the max values and indices for the matrix over...

3 years ago | 1

| accepted

Answered
randi generating random complex numbers from 4-QAM
My other answer focused on "Why didn't this syntax work?" (and concluded that you don't have a recent enough version). This is ...

3 years ago | 0

Answered
Calculating error from parameter distribution
I don't know if there is a way to do this analytically, but I believe you should be able to calculate the error using Monte Carl...

3 years ago | 0

Answered
randi generating random complex numbers from 4-QAM
Your code works fine for me, and here: a = randi([-2,2],10e4,1,"like",1i); plot(real(a),imag(a),"o") I'm not sure what to s...

3 years ago | 0

| accepted

Answered
plotting 2d matrix 240*240 in 3d plotting
You have not given us enough information to understand what you want. Take a look at the MATLAB Plot Gallery to find something ...

3 years ago | 0

Answered
How to find the most used word in a text?
I'm putting this answer here as possibly the "canonical" MATLAB answer, but I expect you do not have the Text Analytics Toolbox....

3 years ago | 1

Answered
How to customise Polar Plots
% Create plot figure theta = linspace(0,2*pi,25); rho = 2*theta; polarplot(theta,rho); % Define a variable with the tick ...

3 years ago | 0

Answered
Why is this logical "&&" passing the "if" statement?
Your code suggests that you think if year/4 is checking if year is divisible by 4. But that is not what the syntax is doing. I...

3 years ago | 0

Answered
How I can ignore NaN during calculating @std using "retime.
retime(f2,'yearly',@(x)std(x,'omitnan'))

3 years ago | 1

| accepted

Answered
EpsilonSkewNormal no longer available in Fitdist or Distributuion Fitter
I just tried to run pd = fitdist(randn(20,1),"EpsilonSkewNormal") in R2022b, and got Error using fitdist Distribution name '...

3 years ago | 0

Answered
I'm new to Matlab and I am having a hard time typing in fractions with variables, the x usually goes to the wrong part. Can someone tell me how to type in these??
You will benefit from watching the free MATLAB Onramp tutorial. -42*x + 1/42 and x/42 + 215/42 % or (x+215)/42

3 years ago | 0

Answered
GMM - gaussian mixture as summation of pdf
It will be easier to help when we see the data, but the general idea would be to sum the pdfs of your best_model, weighted by th...

3 years ago | 0

Answered
How to efficiently sum values in matrix using indices from a logical statement of a different matrix
%Set up matrix of values A = [0 1 2 3; 1 2 3 4; 2 3 4 5]; %Set up matrix of probabilities B = [0.05 0.02 0.03 0.1...

3 years ago | 0

| accepted

Answered
Center of gaussian mixed distribution area
I downloaded and looked over the paper. I am also not certain what they mean by the "center" of the mixed gaussian model. But, ...

3 years ago | 1

Answered
Finding data in matrice
If M is your data, bigChange = abs(diff(M,1,3)) >= 24;

3 years ago | 1

| accepted

Answered
How to find mean of cell array
Here is one way: cellfun(@(x)mean(x,3),h,'UniformOutput',false)

3 years ago | 1

Answered
How to draw the delta signal in matlab
Do you mean the Dirac delta function? If so, then dirac might help you. Also, if you do mean the Dirac delta, I hope you realiz...

3 years ago | 0

Answered
How can i do a Multiple Linear Regression
My advice would be to try to read and understand the example from the documentation page for regress. Better yet, I would use t...

3 years ago | 1

| accepted

Answered
How do I pick selected values in a matrix
You want the fraction of zeros in the array? A = ... [0 0 0 0 0 2 2 2 0 0 2 ...

3 years ago | 0

| accepted

Answered
What does sc in imagesc stand for?
scaled colors doc imagesc

3 years ago | 0

Answered
Good practice in conditional test with categorical variable
The reason you are getting this mlint warning isn't really about the categorical variables at all. It is because you are trying ...

3 years ago | 0

| accepted

Answered
sqrtm vs chol to produce draws the multivariate normal distribution
A common reason for not having a positive semidefinite correlation matrix is when the pairwise correlations are estimated (or ob...

3 years ago | 1

Answered
Truncated answers when querying chatgpt with Matlab
My impression from searching the same topic is that there is an unpublished token limit (which will roughly translate to a chara...

3 years ago | 0

Answered
How to extract diagonal elements of multidimensional array ?
rng('default') N = 4; A = rand(N,N,N); A(1:N^2+N+1:end)

3 years ago | 3

| accepted

Answered
Using histcounts to determine loose data mode
I think that you have a case of the XY problem here. Namely, you are asking about your solution to a particular problem, but I s...

3 years ago | 0

Answered
plotting functions over domain
f = @(x,y) (x.^2 + 3*y.^2).*exp(1 - x.^2 - y.^2); % I'm not certain about your notation here x = -1 : 0.05 : 1; y = -1 : 0.0...

3 years ago | 1

Answered
I have 2 columns, i want to find the maximum in the second column and then know what value it is next to on the first column
% Pretend data aw = rand(1221,2) + 250; % Max 2nd col in range, with index [maxW,idx] = max(aw(651:1221,2)); % Absorbanc...

3 years ago | 0

Load more