Answered
Is it possible that, given the same problem, fmincon finds a solution and intlinprog does not?
Your constraints are not feasible, as can be seen by looking at inequalities 4,15, and 23. A=A([4,15,23],:); B=B([4,15,23],:); ...

4 years ago | 1

| accepted

Answered
Input data must be a formatted dlarray.
You have not provided us the means to run your code (implementation of modelLoss is missing as is a sample of the input data). H...

4 years ago | 0

| accepted

Answered
Time-domain convolution doesn't match Frequency-domain multiplication in MATLAB
Note that conv() implements linear convolution, not circular convolution.

4 years ago | 0

| accepted

Answered
How can I find index from a 3D matrix?
M=rand(376,268,764); d = [1, 3, 45, 56, 111, 121, 135, 440, 489, 491, 511, 555, 569, 599, 608, 700]; Md=M(:,:,d); whos M ...

4 years ago | 1

| accepted

Answered
Is properties like global variables?
No, they are not like global variables. They are attached to the app object used by the callbacks and must be accessed similarly...

4 years ago | 0

Answered
How can I select a three dimensional diagonal from a three dimensional array?
out=M( sub2ind(size(M), IX,IR,1:N) );

4 years ago | 0

| accepted

Answered
Image processing of a binary image
load BWimage BW0=BW; BW=imerode(BW, strel('disk',3)); BW=bwpropfilt(BW,'Eccentricity',[0,0.3]); BW=imdilate(BW, ...

4 years ago | 0

Answered
i would like to plot an iterative function
For example, k=linspace(3.5,4.0,5); x=0:0.0001:1; for i=1:numel(k) f =k(i).*x.*(1-x); plot(x,f); x...

4 years ago | 0

Answered
frequency domain convolution problem
You have only generated half a sinc, rather than a full sinc from -infinity to +infinity. Keep in mind as well that there will ...

4 years ago | 1

| accepted

Answered
fsolve issue with high gradient function
You should not be using fsolve for a 1D root finding problem, and particularly not when the function is highly non-differentiab...

4 years ago | 0

Answered
I want to compare fit() using option 'sin1' with the same equation defined using 'fittype'.
How do I make 'fittype' robust to a wide range of (noisy) data and different starting points. The standard option using fit() a...

4 years ago | 0

| accepted

Answered
How I can find intersection point of direction vector and one of the given plane of 3d cube
Fairly eay to do to do with this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/30892-analyze-n-dimensional...

4 years ago | 0

| accepted

Answered
Regression line that includes x and y errors.
I would recommend linear2dFit() form this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/87584-object-orien...

4 years ago | 0

| accepted

Answered
Extract data from columns based on a range from one column.
A=readmatrix('data.xlsx'); starts=find(A(:,3)==0); stops=find(A(:,3)==99); N=numel(starts); assert(numel(stops)==N, 'Miss...

4 years ago | 0

| accepted

Answered
Help creating a Multi-Input CNN with 4D array images for Multi-Channel EEG analysis ?
I know nothing about EEG signal processing, but it seems to me that you should just view the inputs as 299x299 images with 48 ch...

4 years ago | 0

Answered
Loop for issue in me script
clear; clc; A=[1 0 0 -1 0 0; 1 0 0 0 0 0; 0 1 0 0 -1 0; 0 3 0 0 -1 -1; 0 0 1 0 0 -2; 0 -1 1 -2 0 0]; i=1; while 1 B=[...

4 years ago | 0

| accepted

Answered
How to avoid writing a for loop in A\b when A and b are different dimensions
soln=pagemldivide(A,reshape(b,[],1,Nx)); soln=soln(:,:).';

4 years ago | 1

| accepted

Answered
least square curve fitting on a nonlinear equation , set of data available
I would recommend this FEX download, https://www.mathworks.com/matlabcentral/fileexchange/10093-fminspleas fun={@(b,x) (1-exp...

4 years ago | 0

Answered
Optimization of matrix calculations for loop & if statements
[m,n]=size(dx); dX=( dx( [m,1:m,1] , [n,1:n,1] ) ).^2; k=0.25*kappa/dz^2*[0 1 0; 1 0 1; ...

4 years ago | 1

| accepted

Answered
putting conditions on the axis intervals in fsurf
gamma=0.5; rh=linspace(0,3,200); rl=linspace(0,2,200); [Rh,Rl]=meshgrid(rh,rl); p=(gamma*Rh+ (1-gamma)*Rl)/2; p(Rh<Rl)=...

4 years ago | 0

Answered
Trouble with optimization options - equation problem example
options = optimoptions(prob); options.Display='off'; [sol,~,~] = solve(prob,C0,'Options',options);

4 years ago | 0

| accepted

Answered
How do I remove points which are far away from the boundary of domain?
Question : what can i do to remove any points which are out of the boundary nodes ? Use inpolygon to detect which points are wi...

4 years ago | 0

| accepted

Answered
how make a plot where both x and y are varying?
For example, C=(1:10)'; B=linspace(1,4,5); D=1; A=B.*C.*D plot(C,A); legend("B="+B)

4 years ago | 0

Answered
How to plot a function that has a parameter in the interval?
Using the Symbolic Math Toolbox (if you have it): syms t a=1; f=piecewise(0<t & t<a, exp(t), t>=a, 2*exp(t)); fplot(f,...

4 years ago | 0

| accepted

Answered
How to plot a function that has a parameter in the interval?
One possibility: a=1; f=@(t) exp(t).*(0<t & t<a) + 2*exp(t).*(a<=t); fplot(f,[0,2*a])

4 years ago | 0

Answered
how to solve two equation with 2 variables
You could use fsolve or fminsearch fun=@(x) [sin(x(2))+2*x(2); sin(x(1)-1)+2*(x(1)-1)]; [x,fval]=fsolve(fun,[0;0]) [x,f...

4 years ago | 0

| accepted

Answered
trust-region reflective algorithm in lsqnonlin and fmincon: same behavior for "unconstrained" optimization"?
No, they are not the same. They both take steps in a 2D subspace, but for fmincon, the basis vectors for the subspace are determ...

4 years ago | 1

| accepted

Answered
How can I find a cubic bezier curve that minimizes curvature with the Optimization framework?
It's not fminsearch's fault. The function you have created returns the same value all the time: P0 = [0, 0]; P3 = [10, 10]; %...

4 years ago | 1

| accepted

Answered
while loops and prime numbers
Can't you use isprime()? isprime(7) isprime(4)

4 years ago | 0

Answered
Is there a way to have LiveScript buttons call arbitrary functions?
This might be relevant: https://www.mathworks.com/help/matlab/creating_guis/create-simple-live-editor-task.html

4 years ago | 0

Load more