Answered

Optimize model parameters given minimum sum of error square

It does not make sense that there are randomization operations like normrnd in your objective function. How can a function be "m...

Optimize model parameters given minimum sum of error square

It does not make sense that there are randomization operations like normrnd in your objective function. How can a function be "m...

9 days ago | 0

Question

Save and load alternative sets of preferences

I know how to set Preferences in Matlab through GUI buttons, however, suppose I have different sets of preferences that I wou...

10 days ago | 1 answer | 0

Answered

fsolve with one variabel

I don't understand why you would be using Symbolic Math Toolbox variables, syms x unless you were planning to use solve, Tinc...

fsolve with one variabel

I don't understand why you would be using Symbolic Math Toolbox variables, syms x unless you were planning to use solve, Tinc...

12 days ago | 1

| accepted

Answered

curve fitting with dependencies between the coefficients

Re-express your model function as, sin(d1)^2*(1-exp(-a1*(t^n1))) + cos(d1)^2*sin(d2)^2*(1-exp(-a2*(t^n2))) +... ...

curve fitting with dependencies between the coefficients

Re-express your model function as, sin(d1)^2*(1-exp(-a1*(t^n1))) + cos(d1)^2*sin(d2)^2*(1-exp(-a2*(t^n2))) +... ...

12 days ago | 0

Answered

What happens if I use parfor and the fmincon/fminunc option "UseParallel" together?

I don't know the answer to that directly, but it is easy to show by example that turning off 'UseParallel' can be beneficial: o...

What happens if I use parfor and the fmincon/fminunc option "UseParallel" together?

I don't know the answer to that directly, but it is easy to show by example that turning off 'UseParallel' can be beneficial: o...

12 days ago | 0

Answered

fmincon Constraint Query Optimization

Generally, all constraints must operate on the total set of unknows x1,..x10. However, given A1,A2, b1,b2 it is simple enough to...

fmincon Constraint Query Optimization

Generally, all constraints must operate on the total set of unknows x1,..x10. However, given A1,A2, b1,b2 it is simple enough to...

12 days ago | 0

| accepted

Answered

show det(A) = det(A') ?

But it's not true! A=rand(200); isequal(det(A),det(A.'))

show det(A) = det(A') ?

But it's not true! A=rand(200); isequal(det(A),det(A.'))

12 days ago | 0

Answered

Optimization problem on Constraint declaration

We can't tell from your code what the relation is supposed to be between a, wd and x. This might be what you were trying to do, ...

Optimization problem on Constraint declaration

We can't tell from your code what the relation is supposed to be between a, wd and x. This might be what you were trying to do, ...

12 days ago | 0

| accepted

Answered

How to use for loop to set properties' attributes in MATLAB class?

You cannot put a for loop or other complex code inside a properties block. If you wish, you can set a default value for a proper...

How to use for loop to set properties' attributes in MATLAB class?

You cannot put a for loop or other complex code inside a properties block. If you wish, you can set a default value for a proper...

12 days ago | 1

| accepted

Answered

Using the given code, how can I optimize a matrix to minimize a cost function?

Well, the way you would approach it is using fmincon as below. Using your initial guess of zeros(N,M), fmincon is unable to find...

Using the given code, how can I optimize a matrix to minimize a cost function?

Well, the way you would approach it is using fmincon as below. Using your initial guess of zeros(N,M), fmincon is unable to find...

12 days ago | 0

| accepted

Answered

How to input dependent parameters in matlab function?

These two, out = myfun(A,B,optionC,dependent_C1) out = myfun(A,B,optionC,dependent_C2) are not possible simultaneously. If ...

How to input dependent parameters in matlab function?

These two, out = myfun(A,B,optionC,dependent_C1) out = myfun(A,B,optionC,dependent_C2) are not possible simultaneously. If ...

13 days ago | 0

| accepted

Answered

fmincon - Converged to an infeasible point.

The max() operations in your constraints disqualify fmincon as a valid tool for this problem - the constraint functions are assu...

fmincon - Converged to an infeasible point.

The max() operations in your constraints disqualify fmincon as a valid tool for this problem - the constraint functions are assu...

14 days ago | 0

Answered

checking input an integer greater than 0?

validateattributes(yourInput,"numeric",{"integer","nonnegative"})

checking input an integer greater than 0?

validateattributes(yourInput,"numeric",{"integer","nonnegative"})

14 days ago | 0

Answered

Why do the ylabel renderings look different when Property Inspector says they are the same?

I figured it out. The syntax for the second plot needed to be, ylabel('Local Deviation (\%)','Interpreter','latex') ; %percent ...

Why do the ylabel renderings look different when Property Inspector says they are the same?

I figured it out. The syntax for the second plot needed to be, ylabel('Local Deviation (\%)','Interpreter','latex') ; %percent ...

14 days ago | 0

| accepted

Answered

How to solve Ax=b where A is a rectangular matrix for higher order in matlab

x=A\b

How to solve Ax=b where A is a rectangular matrix for higher order in matlab

x=A\b

15 days ago | 2

| accepted

Question

Why do the ylabel renderings look different when Property Inspector says they are the same?

The image below is a screenshot of two different y-axis labels that I have in two different figure windows, generated in R2020a....

15 days ago | 2 answers | 0

Question

How to load a .mat file from a URL

I find that I cannot load a .mat file from a URL. For example, when I try to call load() with the full URL of the attached .mat ...

15 days ago | 1 answer | 1

Answered

Problems about "rotate" function

Presumably because b(end) is the perimeter, i.e., it is a polyshape containing almost no internal area.

Problems about "rotate" function

Presumably because b(end) is the perimeter, i.e., it is a polyshape containing almost no internal area.

16 days ago | 0

| accepted

Answered

Why am I getting 'NaN' values in my vector?

I don't understand the instructions, but maybe this is what it means: x(i+18+1) = mod( x(i+7+1) + x(i+1), 2); y(i+18+...

Why am I getting 'NaN' values in my vector?

I don't understand the instructions, but maybe this is what it means: x(i+18+1) = mod( x(i+7+1) + x(i+1), 2); y(i+18+...

16 days ago | 0

Answered

fmincon nonlinear inequality constraints

function [c, ceq] = nlcon(p) c = p(4)-exp(p(1)-p(2).*p(3).^log(1./2.7)) -35 ; ceq =[ ]; end

fmincon nonlinear inequality constraints

function [c, ceq] = nlcon(p) c = p(4)-exp(p(1)-p(2).*p(3).^log(1./2.7)) -35 ; ceq =[ ]; end

16 days ago | 0

| accepted

Answered

Matrix Operations Horizontal and Vertical Shifts

The spy() function does not care if its input is square, but it doesn't have any relevance to shifting images. I don't know why ...

Matrix Operations Horizontal and Vertical Shifts

The spy() function does not care if its input is square, but it doesn't have any relevance to shifting images. I don't know why ...

16 days ago | 0

Answered

multiplying matrix by another matrix element and using it in a command

clear e for i=numel(T):-1:1 e(:,:,i)=expm(Q*T(i)); end

multiplying matrix by another matrix element and using it in a command

clear e for i=numel(T):-1:1 e(:,:,i)=expm(Q*T(i)); end

16 days ago | 2

| accepted

Answered

Distance Matrix Without Loop

x = [3, 5, 10]; y = [3, 5, 10]; A = abs(x(:)-y(:).')

Distance Matrix Without Loop

x = [3, 5, 10]; y = [3, 5, 10]; A = abs(x(:)-y(:).')

16 days ago | 0

Answered

Hello every one, I have a question related to approximation of functions based on norms

You would not use fmincon. For L1, you could use minl1lin https://www.mathworks.com/matlabcentral/fileexchange/52795-constraine...

Hello every one, I have a question related to approximation of functions based on norms

You would not use fmincon. For L1, you could use minl1lin https://www.mathworks.com/matlabcentral/fileexchange/52795-constraine...

17 days ago | 1

| accepted

Answered

Expand a coordinate array to be wider

I'm assuming A and B are the struct output from regionprops: Z=false(size(BW)); Aunion=Z; for i=1:numel(A) Aunion(A(...

Expand a coordinate array to be wider

I'm assuming A and B are the struct output from regionprops: Z=false(size(BW)); Aunion=Z; for i=1:numel(A) Aunion(A(...

17 days ago | 0

Answered

Multiplying each value of a vector with the corresponding value in another vector?

theta = (E.*A.*alpha.*temp.*[-1 ,1]).'

Multiplying each value of a vector with the corresponding value in another vector?

theta = (E.*A.*alpha.*temp.*[-1 ,1]).'

17 days ago | 0

Answered

Multiplication of matrix including function with vectors

G(s) = C.' * v * B

Multiplication of matrix including function with vectors

G(s) = C.' * v * B

17 days ago | 1

| accepted

Answered

Decimal matrix to binary matrix correspond to each value of decimal matrix.

I just want to be sure you are aware, Matlab is capable of doing bitwise operations on matrices (using bitor, bitand, etc... ) e...

Decimal matrix to binary matrix correspond to each value of decimal matrix.

I just want to be sure you are aware, Matlab is capable of doing bitwise operations on matrices (using bitor, bitand, etc... ) e...

18 days ago | 0

Answered

How to minimize the L1 norm of residuals?

FMINSEARCH would be a good candidate, since you have only two unknowns fun=@(param) norm( f - y(end)./(1 + 10.^((param(1) - x)*...

How to minimize the L1 norm of residuals?

FMINSEARCH would be a good candidate, since you have only two unknowns fun=@(param) norm( f - y(end)./(1 + 10.^((param(1) - x)*...

18 days ago | 0

| accepted