Effacer les filtres
Effacer les filtres

Finding a particular solution when there are infinitely many

1 vue (au cours des 30 derniers jours)
Ikhsan
Ikhsan le 1 Mar 2013
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
  2 commentaires
Ikhsan
Ikhsan le 1 Mar 2013
I tried using this. http://people.clarkson.edu/~wwilcox/ES100/eqsolve.htm "Here are the steps to find a solution numerically:
Convert the equation to a function consisting of everything moved to the left-hand side, e.g. func2(x) = sin(x)-1/2. Create this function in the MATLAB editor, save to the Current Directory, and make certain the current directory is in the path (File / Set Path). For example:
function out = func2(x) out = sin(x) - 1/2; end
Plot this function over the range of interest to see where the solutions are, e.g.:
>> clear, x = - 4:0.01:4; plot(x,func2(x))
Use one of the following formats to find the solution:
>> fzero('func2',3) or >> fzero(@func2,3) or >> fzero('func2', [2,3])
MATLAB finds the value of x nearest 3 that gives func2 = 0. Notice (“whos” or Workspace) that the result is double, so no conversions are necessary for subsequent numeric calculations."
However I received this error.
ans =
@(a,m)a./(b.*((c)^2)*l)-sin(m).*((cos(h)./cos(m))-1).^1.5
>> m = - 4:0.01:4; plot(m,func2(m))
??? Error using ==> plot
Conversion to double from function_handle is not possible.
Juan Camilo Medina
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))

Connectez-vous pour commenter.

Réponses (2)

Walter Roberson
Walter Roberson le 1 Mar 2013
Do not apply solve() to a function handle. Apply fsolve() to function handles, or apply solve() to symbolic expressions.
  5 commentaires
Walter Roberson
Walter Roberson le 5 Mar 2013
Which MATLAB version are you using?
Ikhsan
Ikhsan le 6 Mar 2013
MATLAB R2011b(7.13.0.564), using my school's computer.
My goal is to retrieve the value of 'm' for a given value of 'a', in a specified range of 'm'.
I thought that this would be the way to do it.

Connectez-vous pour commenter.


Juan Camilo Medina
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
Juan Camilo Medina
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.
Ikhsan
Ikhsan le 6 Mar 2013
Modifié(e) : Ikhsan le 6 Mar 2013
You might be right. As stated above, I'm intending to find the value of 'm' for a given value of 'a', in a specified range of 'm'.
The equation involves the solution to quintics. However the solutions(range) i'm interested in only lies in the range of the graph as shown in the picture.

Connectez-vous pour commenter.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by