Answered
How to set two a vector greater than a variable and lower than another variable into a new matrix?
MutCol=randi([aftbod, fwdbod],10,1); aftref=MutCol( aftbod<MutCol & MutCol<midbod); fwdref=MutCol( midbod<MutCol & MutCol<f...

18 days ago | 0

| accepted

Answered
How should I fix my convolutional integral
This might be what you want, subplot(1,2,1); ty=t; plot(ty,y,'LineWidth',2); title('y(t)'); %Second function of the convo...

19 days ago | 0

| accepted

Question


Behavior of repmat with user-defined object
I have defined a class which displays, and in many ways behaves, like a table: >> obj obj = A ...

19 days ago | 0 answers | 0

0

answers

Answered
Sum of all the elements after the matrix diagonal
answer=0; for r = 1:row for c = 1:col if c >= r answer = A(r,c) + answer; end end end...

20 days ago | 1

| accepted

Answered
Arrays of Anonymous Functions used in for loop
It is not valid. Here is one way that I might rewrite the code, terms = input('How many terms are there for the loading? '); L...

22 days ago | 0

| accepted

Answered
How to constructing a matrix of repeated rows v?
Either of the following would work >> Q=repelem(v,size(A,1),1) >> Q=repmat(v,size(A,1),1) but note that it's not normally s...

22 days ago | 0

| accepted

Answered
How do I find the quadratic approximation using this equation?
Consider using this File Exchange tool instead: https://www.mathworks.com/matlabcentral/fileexchange/34765-polyfitn

23 days ago | 0

Answered
using fmincon to optimize function including simultaneous equations
These lines are illegal in Matlab. You cannot put a literal number like 0 on the left hand side of an '=', except when working w...

24 days ago | 1

Answered
Use pdist() and vertcat() using for loop
X = rand(7,7); n = size(X,2); C=cell(n,1); for i=1:n C{i}=pdist(X(:,i)); end C=cell2mat(C);

24 days ago | 0

| accepted

Answered
3-D matrix operations
Another guess, result=convn(RefBlock,[1,1]/2,'valid');

24 days ago | 0

Answered
How to determine curve types by matching experimental data to references
You could fit each curve with all the types and see which gives the least residual.

25 days ago | 0

Answered
Using fminunc() for logistic regression
Can someone tell me why this is happening? The problem has nothing to do with fminunc. As the error message says, your objectiv...

25 days ago | 0

| accepted

Answered
How to make my working function 1)a for loop and 2) vectorize it?
As a hint, this how you could test, without a loop, which entries in the 2nd column of Data are between 1.5 and 4 (numbers that ...

26 days ago | 0

Answered
Index in position 1 exceeds array bounds (must not exceed 1).
You may think EE is 10x51, but it is not...

26 days ago | 0

Answered
How to impose that the solution takes zeros values in some elements using fmincon?
It looks like you simply need f(1:m) >=0 in order for the log expressions to work. Why not just put lower bounds on them lb(1:m...

27 days ago | 1

| accepted

Answered
sometimes I get a warning : rank deficient
should I be concerned about this warning If the line you've shown is what caused the warning, then it's likely x and d are not ...

27 days ago | 0

Answered
rearrangement matrix rows based on vector of indicies
You want this, clear Final_Coordinates Final_Coordinates(I,:)=Coordinates;

27 days ago | 0

Answered
matlab code How to dived 400*500 image into 40*50 and calculate object area in each block. put all blocks in one imafe
Using sepblockfun from the File Exchange https://www.mathworks.com/matlabcentral/fileexchange/48089-separable-block-wise-operat...

28 days ago | 0

Answered
How can I force Matlab to run an enum class constructor?
I'd like to run it without clearing everything (as "clear classes" does). Is there a way to do this? You don't need to clear ...

29 days ago | 0

Answered
How to guess initialization parameters for non-linear curve fitting with nlinfit?
Maybe by doing a Gaussian fit first, it would be easier to guess what the beta(i) parameters should be. You can do a Gaussian fi...

29 days ago | 0

Answered
how to use <= or >= (greater than or equal to) in 'for statements '?
P=nan(size(x)); region=(x>=141.9); P(region) = 0.73*x( region )-103.43; P(~region) = 0.06*x( ~region )-8.04;

30 days ago | 0

| accepted

Answered
how to write this constraint in fmincon
Because the constraint is non-smooth, you cannot use fmincon's nonlinear constraint support to implement this. Instead you have ...

30 days ago | 1

Answered
Why do I get the following error using fmincon?
Because the are unconstrained, the only way the inner max operation can have a finite result is if [A1;A2]*x=[0;0] and therefor...

1 month ago | 0

| accepted

Answered
Why do I get the following error using fmincon?
Could you help me to understand what is wrong? linprog() and therefore innermax() can return an empty matrix [] when it does no...

1 month ago | 0

Question


Programmatically testing whether a variable is an optimoptions object
I was wondering if there was something like an isoptimoptions function that could be used to test in general whether a variable...

1 month ago | 2 answers | 1

2

answers

Answered
Easier method to iterative matrix multiplication?
No, a loop is the best way.

1 month ago | 0

| accepted

Answered
How to set specific variables in fmincon to be integers only?
fmincon doesn't allow integer constraints, but intlinprog and ga do. Failing, that, you could just run a loop that tests all co...

1 month ago | 3

| accepted

Answered
Trouble with spdiags and how it produces Tridiagonal matrix?
Why is this the case and how can I fix it so that it has 4 1s, whilst still having 4 1s in the -1st diagonal as well From the d...

1 month ago | 0

| accepted

Answered
Trouble with spdiags and how it produces Tridiagonal matrix?
matrix = repelem([1 2 3]',[4 , 1 ,5]); matrix2 = repelem([0.5 1.5]',[5,5] ); T=spdiags([matrix matrix2/2], -1:0, 10, 10); T...

1 month ago | 0

Answered
How do I minimize this code
A=input('Enter Matrix A: ') B=input('Enter Matrix B: ') C=input('Enter Matrix C: ') n=length(A); Con=cell(1,n); Obs=Con....

1 month ago | 0

Load more