Answered
How to solve optimization problem using sequential minimal optimization (SMO) in MATLAB
There is this offering on the File Exchange, which I have never used, https://www.mathworks.com/matlabcentral/fileexchange/6310...

3 years ago | 0

| accepted

Answered
truncate at 10^-3
A few options: x=round(pi,3) y=floor(pi*1000)/1000 sprintf('%.3f',x) sprintf('%.3f',y)

3 years ago | 0

Answered
Concatenate content of cells containing vectors
Simpler, yes. Faster, no. A{1,1} = 1 ; A{2,1} = 2 ; A{3,1} = [3 4 5 ]; B{1,1} = 10 ; B{2,1} = [ ]; ...

3 years ago | 1

| accepted

Answered
Did mldivide Implementation Change in R2022b?
The condition number of clsys.A is very poor, so you should not expect any consistency in the result among different implementat...

3 years ago | 2

Answered
Gradient function not matching array dimensions
Alternatively, why not use the gradient command? psi =rand(51); [gradx,grady]=gradient(psi); whos psi gradx grady

3 years ago | 0

| accepted

Answered
Gradient function not matching array dimensions
The expression for the gradient is very simple. Why not just apply the analytical expression on whatever meshgrid you are workin...

3 years ago | 0

Answered
This code is taking a long time to finish. I tried with vectorizing the inner loops n=2:ny-1, m=2:nx-1, but it is still slow. Should I also vectorize the time loop?
Yes, there is no reason to be doing any looping when constructing the variables predictor and corrector. They can be computed in...

3 years ago | 0

| accepted

Answered
How do I use interp2 with mesh grid to backwards warp one image onto another to create a mosaic?
If you use imwarp instead of interp2, the OutputView setting can be used to specify where in the world coordinate system the tra...

3 years ago | 0

Answered
How do I assign multiple variables the array data from multiple rows in a field
Is this what you mean? data={1,2,3,4,5,6}' [A,B,C,D,E,F]=deal(data{:})

3 years ago | 1

| accepted

Answered
minimum value optimization of matrix with constraints
Perhaps as follows: %L=unknown parameter matrix (nxn) where A=L.'*L %Iknown=indices of known elements of A (mx1) %Aknown=kno...

3 years ago | 1

Answered
I am trying to solve current equations of a pv cell using fsolve butit keeps showing error, can someone pls see what the error in my code is?
Perhaps as follows, V=((1:330)-1)*0.1; y=nan(size(V)); for i = 1:numel(V) fhandle = @(I) I -Is*(1-kref.^((V(i)-Vo+...

3 years ago | 0

| accepted

Answered
All my Values not getting stored. Only my Last Value is getting stored
A loop will not accumulate a vector of results unless you tell it where in the vector the result is to be placed, e.g., for i=1...

3 years ago | 0

Answered
Why does layerNormalizationLayer in Deep Learning Toolbox include T dimension into the batch?
Perhaps you can fold your T dimension into the C dimension and use a groupNormalizationLayer instead, with the groups defined so...

3 years ago | 0

Answered
How to find the original vector given the outer product of the vector?
It's only possible up to a multiplicative constant of the form . n=5; psi0 = rand(n,1) + 1i * rand(n,1); outer_product = psi...

3 years ago | 0

Answered
How to find out if a class is a handle class?
How can I find out if a class is a handle or a value class? You can use, isa(obj,'handle') I need a class that inherits from...

3 years ago | 0

| accepted

Answered
Calling the constructor when assigning custom classes as properties
subsequent changes of myprop1 values in one myclass1 object will apply to ALL myclass1 objects. That is not true. You are free ...

3 years ago | 0

| accepted

Answered
Storing all Loop results in an array?
result(counter)=C;

3 years ago | 0

| accepted

Answered
An error caused by removing the space after the plus sign
I agree it is deceptive, but it happens because the 3rd line of your code is interpreted as an attempt to call a function using ...

3 years ago | 2

Answered
Vectorising conditional for loop
Perhaps as follows, empty_struct_data2_idx = cellfun('isempty', {struct_data2(:).cid}.'); match_idx = find(empty_struct_data2_...

3 years ago | 1

| accepted

Answered
filling a matrix with information regarding angles using atan-function
[X,Y]=ndgrid( -R:2*R/(N-1):R ); [theta, position_matrix]=cart2pol(X,Y);

3 years ago | 0

| accepted

Answered
Fmincon Interior Point Method HessianMultiplyFcn needs Jacobians from Constraint Evaluation
See this doc page: https://www.mathworks.com/help/optim/ug/objective-and-nonlinear-constraints-in-the-same-function.html

3 years ago | 0

| accepted

Answered
How to scale the nonlinear constraints of different orders of magnitude in fmincon ?
You could structure pre-calculate a set of normalization weights like in the following: ceq0=abs( nonleqcon(problem.x0) ); ...

3 years ago | 0

| accepted

Answered
How to find intersection of two line objects in 3D space
You can use pdist2 to find the shortest distance of each point on one curve to the other curve. [D,I]=pdist2(Curve1,Curve2,'eu...

3 years ago | 0

| accepted

Answered
Interpolate matrix in 4D
You can use griddedInterpolant (preferable IMHO) or interpn.

3 years ago | 1

Answered
Unique concatenation of multi-dimensional cell arrays
A(:,:,1) = {[1;2;3],[],[3]; [],[],[4]; [],[2;3],[]}; A(:,:,2) = {[2;3;4],[4],[3]; [],[],[4]; [],[2;4],[]}; ...

3 years ago | 0

| accepted

Answered
Mask with a for loop
removeData([2 3 0 0 7 8 0]) function newVec = removeData(vec) newVec = vec; newVec( vec(1:end-1) & ~vec(2:en...

3 years ago | 0

Answered
Motion Estimation between Blocks from Two Images
I imagine you would use imregtform to do the motion estimation. Once you have the motion tform, you would apply it to the centro...

3 years ago | 0

Answered
Finding the columns that contain 1 and 0s(Basic Columns) in MATLAB
Well, I definiitely don't think you should be using rref, which is a very primitive command. Instead , you should use this FEX d...

3 years ago | 0

| accepted

Answered
Access cell array from input in function
You have misspelled atomsStruct in this line: wantedAtoms= atomsStuct(matchingResNameCells)

3 years ago | 1

Answered
Must dependent properties in abstract class be redefined in every concrete subclass?
If your abstract base class defines the Dependent property, then its get.property() method must also be defined in the abstract ...

3 years ago | 0

| accepted

Load more