How can I implicitly solve a single equation in Matlab? - matlab

The following equation is to be solved for M by MATLAB:
(Atemp/At)^2=1/M^2*((2/(gamma+1))*(1+(gamma-1)*M^2/2))^((gamma+1)/(gamma-1))
It is not possible to solve this equation symbolically. In Maple it is easily possible to solve such an equation implicitly; now, is there also a pre-made function in Matlab that does this for me? I could program one myself, but as my skills are limited, its performance would not fit my needs.

I would try using fzero, or if that encounters problems because of complex values/infinities, fminbnd.

Related

How to solve overdetermined system of equations in Matlab?

my problem is the following.
Using linsolve function I am solving an overdetermined matrix 200x50 with very similar elements. Because of this, the solution that I get is not correct. Maybe some of you would have any suggestions how to solve such a system?
Best wishes,
Valerie
It's very likely that your system does not have a solution.
Rather than attempting to solve the system A*x=b, the next best thing you can do is to solve a similar problem:
min norm(A*x-b)
When the norm used is the Euclidean norm, the solution to the minimization problem is called a "Least-Squares solution"
The MATLAB syntax is:
x = A\b

How to solve a matrix optimization using MATLAB cvx

I have an optimization problem shown in uploaded figure file.
Determining the optimal matrix X maximizing given objective function is the problem.
However, since the function inside the log-function is non-concave, MATLAB CVX doesn't work.
How can I solve the problem? How should I transform the form?
Please give me a hand

Fit data with a numerical ode solution (on Matlab)

I am looking for a way to fit my experimental data by a theoretical model which is described by a non-linear differential equation.
Unfortunately this latter can only be solved numerically (by solving this second degree, non-linear differential equation).
I manage to solve the differential equation for a set of parameters using the ode45 Matlab solver but now I want to find the proper fit parameters of the model. Also, I may have to mention that my ode45 is initiated at z=zmax (max being large so I can assume it is infinity) by y(zmax)=y0 and yprime(zmax)=yprime0 and I solve backward (from zmax to z=0).
I am quite new to this kind of numerical problems, are there classical ways to solve such problems?
Does anyone knows if there is a Matlab procedure which would help me solve this? On which principles is it based/constructed? (if possible I'd like to know the theoretical trick to solve this problem in a smart way, not by trying all the possible sets of parameters which would be very time consuming (I have 5 fit parameters!).
Thank you for your precious help!
You have facy methods in the Optimization Toolbox. In case you don't have access to it, you could do it manually by:
Selecting a cost function between the experimental and model data. For example, mean-squared-error.
Doing heuristic optimization of the cost function. For example, Nelder-Mead method.

Solving 4th order ODE numerically with Matlab

I have been trying to solve this equation analytical, where C and L is constants:
There is no problem with the general solution, but with the conditions, the expression is close to unsolveable.
Now I'm trying to solve the problem with Matlab, where I believe i shall use the ode45 solver. I just don't know what to do with the integral and omega which is the value I'm trying to find.
I know that i haven't given any code snippet, but I just can't figure out how to solve this problem in Matlab.
I hope someone can help me, thanks.

How to use integer and binary variables with matlab GA toolbox?

I used matlab GA toolbox to solve an integer programming problem. The problem has some binary variables.
I used nonlinear constraints such as x*(1-x) = 0 for binary variables, but matlab outputs real values for these variables.
One another problem is that final solution is not feasible! I used this line of code:
options = gaoptimset(options,'CreationFcn', #gacreationlinearfeasible);
But matlab still generating no feasible solutions.
A friend suggested using inequality constraints instead of equality ones, but that failed.
Then there is two problems. 1) say matlab about binary variables, 2) generating feasible solutions.
How can I use matlab GA for my problem?
I'm not sure it is best solution, but I solved my problem by substitute constraints for penalty coefficients in fitness function.
After all, as a suggestion, anyone who has same problem can try GAlib (C++ genetic library) instead of matlab.