0
|
6813 Views
|
2 Replies
|
3 Total Likes
View groups...
Share
GROUPS:

# How to solve this simple non-linear equation numerically with Abs[]?

Posted 11 years ago
 Hi,I was just trying to get into Mathematica a little more but I've been stuck when trying to solve an equation. The H function models a low pass filter and I want to find out the cut off frequency. Z[\[Omega]_] := 1 /(\[ImaginaryJ]*\[Omega]*c) H[\[Omega]_] := Z[\[Omega]]/(r + Z[\[Omega]])  c = 1*^-6; r = 1000; LogLogPlot[Abs[H[2 \[Pi]*f]], {f, 1, 1000000}, ImageSize -> Large, AxesOrigin -> {1, 1*^-3}, GridLines -> {{160}, {}}]  NSolve[Abs[H[2 \[Pi]*f]] == 1/Sqrt[2], f, Reals] NSolve[Abs[H[2 \[Pi]*f]] <= 1/Sqrt[2], f, Reals] f = 160; Abs[H[2 \[Pi]*f]] < 1/Sqrt[2]Plotting the simple diagram worked. Now, when I try to numerically solve this (in)equation, I get this error:NSolve::nddc: "The system ... contains a nonreal constant -500000\ I. With the domain Reals specified, all constants should be real."Even though the Abs[] around it should get rid of the i. However, when I "manually" test the inequation, I get back true. What am I doing wrong?Thanks for any help
2 Replies
Sort By:
Posted 11 years ago
 From Documentation on NSolve (see Details section) you can find out thatNSolve deals primarily with linear and polynomial equations. You obviously deal with non-polynomial equation due to Abs[] function. In this cases use FindRoot function. From plot we see that the solution is located around 160:Z[\[Omega]_] := 1/(\[ImaginaryJ]*\[Omega]*c)H[\[Omega]_] := Z[\[Omega]]/(r + Z[\[Omega]])c = 1*^-6; r = 1000;LogLogPlot[{1/Sqrt[2], Abs[H[2 \[Pi]*f]]}, {f, 1, 1000000}, ImageSize -> Large, AxesOrigin -> {1, 1*^-3}, GridLines -> {{160}, {}}]And this simple line solves your problem:FindRoot[Abs[H[2 \[Pi]*f]] == 1/Sqrt[2], {f, 100}](* {f -> 159.155} *)
Posted 11 years ago
 In[1]:= Z[?_] := 1/(\[ImaginaryJ]*?*c);H[?_] := Z[?]/(r + Z[?]);c = 1*^-6; r = 1000;Reduce[Abs[H[2 ?*f]] == 1/Sqrt[2] && f > 0, f]Out[4]= f == 500/?if you want the result in terms of radians instead of a decimal approximation, just as long as you don't use a decimal point anywhere