Answered
Randomising a vector with respect to the probability of the outcome
I=randi(5,1,12); J=1:12; result=reshape( sparse(I,J,1,5,12) ,[],1); full(result(:))

5 dagen ago | 0

Answered
Creating artificial pictures based on an original picture
Sounds like a job for a GAN, https://www.mathworks.com/help/deeplearning/ug/train-generative-adversarial-network.html

5 dagen ago | 0

Answered
Plot for the following program is not showing up, i am trying to plot value of M1 for given L
M1 needs to be a vector: for L=1:799 if ____ M1(L)=____ elseif ___ M1(L)=____ else M1(L)...

6 dagen ago | 0

Answered
Matlab fitting an anonymous function
The difference is that, with an anonymous function, you now have the responsibility of providing the StartPoint for the iterativ...

6 dagen ago | 0

| accepted

Answered
How to solve 4 non linear equations with 5 unknowns using least square method
There are probably going to be infinite solutions, but you can use fsolve() to find one of them.

6 dagen ago | 0

Answered
Matlab static variable that can be modified by super class and sub class?
You mean you want all instances of the class and its subclasses to share the same copy of staticvar? If so, you can write the s...

6 dagen ago | 0

| accepted

Answered
Nested for loop performance speed up
With the data sizes you've shown, the final result D will be a 7GB logical matrix. That seems like a non-starter. If you can red...

6 dagen ago | 1

Answered
Polyshape rotation without distort
Probably because the data aspect ratio of your plot is not 1. I.e., the scales of your x and y axes are different.

6 dagen ago | 0

| accepted

Answered
How to split array into sub arrays?
The way you would do this is to convert the vector to a cell array. There is no way to do it without a loop. You can use mat2til...

6 dagen ago | 0

Answered
Split large vector into smaller vectors based on upper and lower limits
Using this File Exchange submission, https://www.mathworks.com/matlabcentral/fileexchange/78008-tools-for-processing-consecutiv...

6 dagen ago | 0

Answered
Using parfor eliminates use of multithreading
If you are getting the best performance from the Linux command line, perhaps a solution would be to invoke the Linux command li...

7 dagen ago | 0

Answered
How do I find the instersection on my plot?
You can use fzero, e.g., fun=@(x)x^2; y=4; x_intersect=fzero(@(x) fun(x)-y,[0,1e6])

7 dagen ago | 0

| accepted

Answered
running a consensus protocol on a directed graph created my an Adj-matrix
Did you mean to have this? ux(i,1) = ux(i,1) + (x(i,j)- x(i,i)) It's not clear from your original code how you expected to get...

7 dagen ago | 0

Answered
splitapply doesn't split well into bins
You can use accumarray instead. spltsum=accumarray(dis(valid), cell1areas(valid) , [90,1]);

7 dagen ago | 0

| accepted

Answered
why my integral is not a numerical value?
f=matlabFunction( bras*ket); phase=1i*integral(f,-2*pi,2*pi)

7 dagen ago | 0

| accepted

Answered
Creat a loop for Image processing
It is possible: for i=1:69; pic=im2gray( imread(i+".tiff") ); ... end

7 dagen ago | 0

Answered
fit function does not work correctly
You shouldn't use a custom model when one is unnecessary. It is an important advantage to use one of the built-in models when po...

7 dagen ago | 0

Answered
method syntax for handle objects
Well, the second syntax is the one you would normally use if the method is intended to return a new, freshly constructed, indepe...

8 dagen ago | 0

Answered
Why does my nonlinear (exponential or trigonometric) model fit poorly?
Here are the most frequent pitfalls that I see: (1) Bad Data Either the data is too noisy or have too few data points. Garbage...

8 dagen ago | 1

Answered
Apply the same matrix index to another matrix (bootstrap for matrix processes)
Data=[5 7 3 6 6 9 7 2 4]; indices=[ 2 1 2 3 2 1 1 3 3]; tmp=num2cell(Data,2); ...

8 dagen ago | 0

| accepted

Answered
Memory increases on GPU while performing modification inplace
reshape() does not result in data copying, but permute() does. It cannot be done in place, because it is reordering the data in ...

8 dagen ago | 0

Answered
Custom fit to negative exponential
You don't need a custom fit for your model. You can use the exp2 model, Y = a*exp(b*x)+c*exp(d*x) but put upper and lower boun...

8 dagen ago | 0

Answered
MATLAB not detecting any of my functions from methods
You have a missing 'end' on your plot() method and an extra 'end' on your public methods block.

8 dagen ago | 0

Answered
Custom fit to negative exponential
Possibly you have to supply a better initial guess. In any case, I would recommend fminspleas (Download) for this problem, which...

8 dagen ago | 0

Answered
To add rows and columns in the start and at the end for a matrix
Perhaps with padarray https://www.mathworks.com/help/images/ref/padarray.html

8 dagen ago | 0

| accepted

Answered
Matlab Problem with an Image
A=rgb2gray(imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/763086/image.jpeg')); B=bwareafilt( imbinar...

8 dagen ago | 0

| accepted

Answered
How do I use multi-parameters in my optimization problem for fminunc?
You can do something like that in the problem-based framework. A=optimvar('A',N,3); x=optimvar('x',1); fun=fcn2optimexpr( ...

9 dagen ago | 0

Answered
Sparse Array with reshape
Consider downloading ndSparse. FF = ndSparse.sprand( [36, 10,4^3],0.2); TT = ndSparse.sprand([1,10, 4^3], 0.2); Result = spar...

9 dagen ago | 0

| accepted

Answered
How to replace cell and neighbors that are zero in a matrix with nan
Perhaps as follows: A=[ 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 ...

9 dagen ago | 0

Answered
I have a system with 11 equations and 9 unknowns, how can I solve these equation sets?
See fsolve(), or if you want to put upper/lower bounds on the unknowns then see lsqnonlin().

9 dagen ago | 0

Load more