Answered
How can I store and sum matrix using loop for?
A = sparse matrix (20000x20000) L = speye(size(A)); for ii = 1:200 C{ii} = A^ii; L = L + C{ii}; end

4 years ago | 1

| accepted

Answered
How can I interpolate a vector to increase the length up to a desired quantity?
You can do it with interp1() or griddedInterpolant().

4 years ago | 0

Answered
how to find intersection point in arrays with for cycle?
isel2 is an empty set Sure, why not? Nothing in your code reveals why lonP= 13.5, latP= 41.9 are expected to coincide exactly w...

4 years ago | 0

| accepted

Answered
Can I combine multiple objective functions that share same optimization parameters for lsqnonlin?
No, lsqnonlin is not a multi-objective solver. It minimizes the single objective function sum(rssOutput.^2). If you want it to m...

4 years ago | 0

| accepted

Answered
How to find the index of first and last nonzero elements in each column?
A=[0 0 0 0 0 0 0 0 1 0 4 0 2 0 5 0 3 1 6 ...

4 years ago | 1

Answered
suggest me on what should be done for step 5 and 7.
For step 5, imgaussfilt(Image1,fsize,'FilterSize',6*fsize+1);

4 years ago | 0

Answered
the math of movmean
If if the data looks like, DATA=[x1,x2,...xn , a,b,c,d,e, y1,y2,....,ym] then movemean(DATA,5) will replace c with mean...

4 years ago | 0

Answered
Roots of the determinant of a 12x12 matrix with single nonlinear variable
I would plot the determinant as a function of w. Then, based on inspection of the plot, I would use fzero to find roots in appro...

4 years ago | 0

Answered
How to have Matlab create a random matrix that is fullrow rank?
rand() or randn() should give you a full row rank (in probability one) matrix provided there are fewer rows than columns. rank(...

4 years ago | 0

| accepted

Answered
How to split data set into multiple bins and perform condition statement on bins
Use the discretize() command. https://www.mathworks.com/help/matlab/ref/double.discretize.html to assign bin labels to each o...

4 years ago | 0

Answered
Generate Look up table from curve fit toolbox
You can export the resulting fit to the Matlab base workspace as described here, https://www.mathworks.com/help/curvefit/genera...

4 years ago | 0

Answered
Moving mean in matrix using first column
a = [1 3 5 2 4 6 7 8 10; 4 3 5 2 8 6 7 8 7; 5 8 9 7 2 3 6 1 5]; res=@(z) reshape(z,3,1,[]); A=arrayfun( @(i) ...

4 years ago | 0

| accepted

Answered
How to calculate the moving average of a finite duration data using sliding concept?
Both are wrong. X = [2 3 4 5 6 8]; win=ones(1,4)/4; Y = conv(X,win,'full')

4 years ago | 1

| accepted

Answered
How to multiply a subset of matrix by a column from another matrix?
B = pagemtimes( reshape(A,128,257,[]) , reshape(y,257,1,[]) ) ; B=squeeze(B);

4 years ago | 0

| accepted

Answered
Transpose multiple columns to one row
num_sheets = 41; C = cell(1,num_sheets); for i = 3:num_sheets C{i} = readmatrix('filename',i ,Range="O2:O57").'; end ...

4 years ago | 1

Answered
Defining objective function using nested functions (Genetic Algorithm Solver)
I suspect that the r and x are both in fact 36x36 matrices while a is a 36x1 vector. If so, then, the correct implementation is,...

4 years ago | 0

| accepted

Answered
How to deal with CELL2MAT does not support cell arrays containing cell arrays or objects?
A=num2cell(num2cell(eye(3)),1) cell2matRecursive(A) function B=cell2matRecursive(B) if ~iscell(B{1}) B=cell2mat(...

4 years ago | 0

| accepted

Answered
Calling a automatically generated vector valued function handle with a vector
Because the original symbolic function is defined only on R^1, you must post-vectorize the matlabFunction output. syms x f = [...

4 years ago | 0

Answered
How can I reshape a square matrix to a rectangular matrix based on its adjacency list?
A=[ 0 -1 0 0 0 0 -2 -2 0 0 0 0 0 2 -1 0 0 0 0 0 0...

4 years ago | 1

| accepted

Answered
vector notation with data from struct array
Error in DMD_Prediction (line 42) P = [0 diff(E)/t_delta]; In all likelihood diff(E) is not a row vector. THat sho...

4 years ago | 0

| accepted

Answered
Create a random matrix with small gradient
A=rescale(rand(5),0,0.1);

4 years ago | 0

Answered
How can I decide one struct to another one?
%structfun(@(a,b) a./b, s1,s2,'uni',0) %EDIT: s3=s1; for fld=fieldnames(s1)' fld=fld{1}; s3.(fld)=s1.(fld)/...

4 years ago | 0

| accepted

Answered
Straight line approximation of elements in array
s=[0 NaN 5 NaN 0 NaN 0 NaN 5 NaN 0 NaN 0 NaN 5 NaN 0 NaN 0 NaN 5]; fillmissing(s,'linear')

4 years ago | 0

| accepted

Answered
Avoiding NaN Values When Using a Loop
entropy=-cumsum(pmf.*log2(pmf),'omitnan'); fprintf('Entropy Val %d: %f.20 \n', l:numel(entropy), entropy)

4 years ago | 0

| accepted

Answered
How can I split one large matrix to struct with several fields?
M=rand(100,20); Mcell=num2cell(permute(reshape(M,[10,10,20]),[1,3,2]),[1,2]); cell2struct(Mcell, "f"+(1:10),3)

4 years ago | 0

| accepted

Answered
Replace certain Values within a Matrix Based on Indices from Another matrix
[~,J,I]=find(gridsupplyidx); idx=sub2ind(size(gridsupply),I,J); gridsupply(idx)=5;

4 years ago | 1

| accepted

Answered
How can i sum my objective function with each iteration
sum(x.*r.*a,'all')

4 years ago | 0

| accepted

Answered
Is there a way to imregister some points on a matlab figure
If you have individual points as input to the registration, you should use fitgeotrans().

4 years ago | 0

Answered
Creating a matrix of different row sizes
gridsupply=sorted_dailygrid.*((1:24)<=ddailygridhours)';

4 years ago | 0

| accepted

Answered
Representation of matrix in term of sets
Simpler: d=diag(A); A(d==1,:)=0; [I,J]=find(A); k=[I,J]; I don't know what you mean by "set form". If you want each pai...

4 years ago | 0

| accepted

Load more