Finding a particular solution when there are infinitely many
Afficher commentaires plus anciens
I need to find a particular solution for a specific range.
The solution I got using the solve method led me to a 0.
>> a1 = 5;
>> a2 = 10;
>> b = 13;
>> c = 1*10^-3;
>> d = 0.57 * 10^-3;
>> e = 0.57 * 10^-3;
>> d1 = d/c;
>> e1 = e/c;
>> f = 0.02 * 10^-3;
>> g = d/c+e/c-1;
>> h = acos(1 - f/(2*g*c));
>> n = 6*(10^6)*g^2+3*(10^6)*g*6894.75729;
>> syms m;
k = @(a,m) a ./ (b .* ((c)^2)*n) - sin(m) .* ((cos (h) ./ cos (m))-1).^1.5;
solve(m);
>> solve(m)
ans =
0
However, the range of values where my solution lies is 0.35< m < 0.41 as shown in the photo. which isn't 0. http://i.imgur.com/RrMO1Ro.jpg
Previous related question I asked which was solved for some history. http://www.mathworks.com/matlabcentral/answers/64353-error-using-char-how-do-i-solve-a-transcendental-equation-for-given-variables
2 commentaires
Ikhsan
le 1 Mar 2013
Juan Camilo Medina
le 1 Mar 2013
Modifié(e) : Juan Camilo Medina
le 5 Mar 2013
Matlab cannot plot func2 because you haven't define a, in other word, you are trying to do a 2D plot of a multivarible equation without the necessary input arguments.
You need to define what a is, let's say you picked a to be 5 then try:
m = - 4:0.01:4; plot(m,func2(5,m))
Réponses (2)
Walter Roberson
le 1 Mar 2013
0 votes
Do not apply solve() to a function handle. Apply fsolve() to function handles, or apply solve() to symbolic expressions.
5 commentaires
Ikhsan
le 1 Mar 2013
Walter Roberson
le 1 Mar 2013
You should have used @func2 not @myfun
Ikhsan
le 2 Mar 2013
Walter Roberson
le 5 Mar 2013
Which MATLAB version are you using?
Ikhsan
le 6 Mar 2013
Juan Camilo Medina
le 1 Mar 2013
your syntax is wrong, instead of using
solve(m)
try
syms m a;
k = @(a,m)a./(b.*((c)^2)*n)-sin(m).*((cos(h)./cos(m))-1).^1.5;
solve(k(a,m)==0,m)
But it also appears that your equation is ill-posed. If you look at the picture you posted, they are plotting E vs. a, and not m. It's rather strange that an equation with a bunch of sines and cosines gives you a straight line.
3 commentaires
Ikhsan
le 2 Mar 2013
Juan Camilo Medina
le 5 Mar 2013
I think your problem is not how you solve it, but your equation instead. It seems to be ill-posed. Check your problem statement.
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!