I want to solve xA=b with constraint 0<=x for x.
I found functions like lsqnonneg and lsqlin which solves for Ax=b. However, couldn't find a good way to solve for xA=b.
How can I solve xA=b with non-negative x constraint?
As David commented, it is straightforward to show that
so you can use standard methods to solve the problem with A' and b' and then transpose the answer.
Related
The following definite integral can not be done in "Matlab R2013a", although it can be done analytically in other mathematics programs. Why?
syms r M c real
assume(M>0)
assume(c>M)
y=1/(sqrt((r^2-M)*(r^2/c^2-1))*r);
int(y,r,c,inf)
The answer is
atanh(sqrt(M)/c)/sqrt(M).
Thanks
There's another way to write the solution:
-log((-M-c^2+2*sqrt(M)*c)/(M-c^2))/(2*sqrt(M))
I don't use Matlab, but can you try assuming that M does not equal c^2?
How do I solve a quadratic Maximization problem in MATLAB? It seems MATLAB only supports minimization problems, so is there a mathematical concept I can use?
simply multiply by (-1) before and after using the minimization function
Using quadprog function in MATLAB.
This function solves Quadratic Programming problems in MATLAB.
Of course if you want the maxima instead of the minima, you can multiply the cost function by -1.
Good Luck.
The above answer #Drazick seems not right.
quadprog() in matlab requires H to be positive definite. If we simply multiply (-1), -H is a negative definite matrix, which violates the requirement.
Another optimization function called fmincon( ) may help.
I have a matrix equation and I want to solve it in MATLAB. The equation is
X^(-1)AX=B.
Where X is an unknown symmetric 3x3 matrix, A is known and B is a diagonal matrix (There isn't any condition on B's elements, just diagonal).
Please help me solve this problem!
From the information you've given it appears that you are looking for a symbolic solution which Matlab is not the best at (usually Mathematica is prefered or check out Wolfram Alpha). If you absolutely need Matlab then you could use the 'solve()' command.
However, honestly you are dealing with a rather simple linear system of small dimensions so it is probably easiest to just work this out by hand. Check out Matrix Cookbook for help. Also it really just looks like you are just trying to solve for the eigenvector matrix so possibly the command eig() might help ??
Does anyone know what functions are available for solving linear systems when the equations are actually congruences mod m? The desire is to solve a linear system (Ax = b) for values x in which "Ax is congruent to b"
A discussion of how to perform gaussian elimination in this situation can be found here, but I was hoping to use MATLAB rather than attempting to do it by hand.
Have a look at the lincon() method found here:
http://www.mathworks.com/matlabcentral/fileexchange/32856-system-of-linear-congruences/content/lincon.m
In MATLAB, I have an equation a*x+b=0 for which I have a and b defined during execution. What is the best way I can solve the equation using what I've set for a and b.
I guess that you are going to have to use num2str() and related functions to build the equation in the string form that solve() requires. That shouldn't be too difficult should it?
Can't you solve symbolically in terms of a and b, and then replace a and b by their value in the result?