<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934</link>
    <title>MATLAB Central Newsreader - matlab solve function</title>
    <description>Feed for thread: matlab solve function</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2013 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.ch/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Sat, 02 Oct 2010 01:20:29 +0000</pubDate>
      <title>matlab solve function</title>
      <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934#784557</link>
      <author>Anthony Hopf</author>
      <description>I am trying to find the scan angles of an expanding beam as the scan angle increases, but I don't want any overlap from beam realization to beam realization.  The beamwidth is a function of the scan angle.  I was hoping to use the matlab solve function no dice.  My next thought is to do this numerically, but I need to do it a bunch of time.&lt;br&gt;
&lt;br&gt;
here is the code:&lt;br&gt;
npa = 1.3;&lt;br&gt;
&lt;br&gt;
bwaz = 2;&lt;br&gt;
&lt;br&gt;
az1 = 0;&lt;br&gt;
&lt;br&gt;
gamma = az1+(bwaz*cosd(az1)^npa)/2;&lt;br&gt;
&lt;br&gt;
solve('az2 - (bwaz*cosd(az2)^npa)/2 - gamma = 0');&lt;br&gt;
&lt;br&gt;
solving for az2, the next scan angle.&lt;br&gt;
&lt;br&gt;
Thank you</description>
    </item>
    <item>
      <pubDate>Sat, 02 Oct 2010 01:55:08 +0000</pubDate>
      <title>Re: matlab solve function</title>
      <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934#784559</link>
      <author>Anthony Hopf</author>
      <description>I screwed up the code:&lt;br&gt;
&lt;br&gt;
npa = 1.3;&lt;br&gt;
&lt;br&gt;
bwaz = 2;&lt;br&gt;
&lt;br&gt;
az1 = 0;&lt;br&gt;
&lt;br&gt;
gamma = az1+(bwaz/cosd(az1)^npa)/2;&lt;br&gt;
&lt;br&gt;
solve('az2 - (bwaz/cosd(az2)^npa)/2 - gamma = 0','az2');&lt;br&gt;
&lt;br&gt;
still can't get it, I get this error:&lt;br&gt;
&lt;br&gt;
Warning: Explicit solution could not be found. &lt;br&gt;
&amp;gt; In solve at 98</description>
    </item>
    <item>
      <pubDate>Sat, 02 Oct 2010 02:37:06 +0000</pubDate>
      <title>Re: matlab solve function</title>
      <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934#784562</link>
      <author>Roger Stafford</author>
      <description>"Anthony Hopf" &amp;lt;anthony.hopf@gmail.com&amp;gt; wrote in message &amp;lt;i863ds$5r0$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I screwed up the code:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; npa = 1.3;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; bwaz = 2;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; az1 = 0;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; gamma = az1+(bwaz/cosd(az1)^npa)/2;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; solve('az2 - (bwaz/cosd(az2)^npa)/2 - gamma = 0','az2');&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; still can't get it, I get this error:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Warning: Explicit solution could not be found. &lt;br&gt;
&amp;gt; &amp;gt; In solve at 98&lt;br&gt;
- - - - - - - - - -&lt;br&gt;
&amp;nbsp;&amp;nbsp;This looks like a good problem for matlab's 'fzero'.&lt;br&gt;
&lt;br&gt;
Roger Stafford</description>
    </item>
    <item>
      <pubDate>Sat, 02 Oct 2010 04:17:04 +0000</pubDate>
      <title>Re: matlab solve function</title>
      <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934#784575</link>
      <author>Walter Roberson</author>
      <description>On 01/10/10 8:20 PM, Anthony Hopf wrote:&lt;br&gt;
&amp;gt; I am trying to find the scan angles of an expanding beam as the scan&lt;br&gt;
&amp;gt; angle increases, but I don't want any overlap from beam realization to&lt;br&gt;
&amp;gt; beam realization. The beamwidth is a function of the scan angle. I was&lt;br&gt;
&amp;gt; hoping to use the matlab solve function no dice. My next thought is to&lt;br&gt;
&amp;gt; do this numerically, but I need to do it a bunch of time.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; here is the code:&lt;br&gt;
&amp;gt; npa = 1.3;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; bwaz = 2;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; az1 = 0;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; gamma = az1+(bwaz*cosd(az1)^npa)/2;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; solve('az2 - (bwaz*cosd(az2)^npa)/2 - gamma = 0');&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; solving for az2, the next scan angle.&lt;br&gt;
&lt;br&gt;
Poking around with this, it appears that there is no rational solution &lt;br&gt;
for it.&lt;br&gt;
&lt;br&gt;
You can, however, obtain a good approximation for it that you could then &lt;br&gt;
pump into root finder. What you do is a series or taylor expansion on &lt;br&gt;
the equation you are attempting to solve, out to order 5; dropping the &lt;br&gt;
order term would leave you with a quartic, which you could then find the &lt;br&gt;
first real root of. That real root will not be an exact solution, but it &lt;br&gt;
will be right to several digits, which would give you a fair start to &lt;br&gt;
the best solution.&lt;br&gt;
&lt;br&gt;
You can do the series expansion of the symbolic expression without &lt;br&gt;
giving a value to any of the variables that will change per iteration, &lt;br&gt;
and thereafter evaluate the resulting expression at the current variable &lt;br&gt;
values.&lt;br&gt;
&lt;br&gt;
Mind you as this will be the root of a quartic, it will not be an &lt;br&gt;
especially simple expression...</description>
    </item>
    <item>
      <pubDate>Mon, 04 Oct 2010 14:49:42 +0000</pubDate>
      <title>Re: matlab solve function</title>
      <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934#785025</link>
      <author>Steven_Lord</author>
      <description>&lt;br&gt;
&lt;br&gt;
"Anthony Hopf" &amp;lt;anthony.hopf@gmail.com&amp;gt; wrote in message &lt;br&gt;
news:i861ct$spd$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; I am trying to find the scan angles of an expanding beam as the scan angle &lt;br&gt;
&amp;gt; increases, but I don't want any overlap from beam realization to beam &lt;br&gt;
&amp;gt; realization.  The beamwidth is a function of the scan angle.  I was hoping &lt;br&gt;
&amp;gt; to use the matlab solve function no dice.  My next thought is to do this &lt;br&gt;
&amp;gt; numerically, but I need to do it a bunch of time.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; here is the code:&lt;br&gt;
&amp;gt; npa = 1.3;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; bwaz = 2;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; az1 = 0;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; gamma = az1+(bwaz*cosd(az1)^npa)/2;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; solve('az2 - (bwaz*cosd(az2)^npa)/2 - gamma = 0');&lt;br&gt;
&lt;br&gt;
Don't write your expression as a string; SOLVE can't use the values that you &lt;br&gt;
defined above if you pass the expression into SOLVE as a string.  Instead, &lt;br&gt;
use:&lt;br&gt;
&lt;br&gt;
syms az2&lt;br&gt;
S = solve(az2 - (bwaz*cos(pi*az2/180)^npa)/2 - gamma, az2);&lt;br&gt;
&lt;br&gt;
[Note that COSD is not defined for symbolic variables, so I replaced &lt;br&gt;
cosd(az2) with cos(pi*az2/180).]&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com&lt;br&gt;
comp.soft-sys.matlab (CSSM) FAQ: &lt;a href="http://matlabwiki.mathworks.com/MATLAB_FAQ"&gt;http://matlabwiki.mathworks.com/MATLAB_FAQ&lt;/a&gt;&lt;br&gt;
To contact Technical Support use the Contact Us link on &lt;br&gt;
&lt;a href="http://www.mathworks.com"&gt;http://www.mathworks.com&lt;/a&gt; </description>
    </item>
    <item>
      <pubDate>Mon, 04 Oct 2010 14:56:04 +0000</pubDate>
      <title>Re: matlab solve function</title>
      <link>http://www.mathworks.ch/matlabcentral/newsreader/view_thread/292934#785028</link>
      <author>Walter Roberson</author>
      <description>On 04/10/10 9:49 AM, Steven_Lord wrote:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; "Anthony Hopf" &amp;lt;anthony.hopf@gmail.com&amp;gt; wrote in message&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; solve('az2 - (bwaz*cosd(az2)^npa)/2 - gamma = 0');&lt;br&gt;
&lt;br&gt;
&amp;gt; Don't write your expression as a string; SOLVE can't use the values that&lt;br&gt;
&amp;gt; you defined above if you pass the expression into SOLVE as a string.&lt;br&gt;
&amp;gt; Instead, use:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; syms az2&lt;br&gt;
&amp;gt; S = solve(az2 - (bwaz*cos(pi*az2/180)^npa)/2 - gamma, az2);&lt;br&gt;
&lt;br&gt;
Good point in general.&lt;br&gt;
&lt;br&gt;
In this particular case, there is no analytic expression for the &lt;br&gt;
solution, so solve() will attempt to find numerical solutions. When I &lt;br&gt;
was looking in to this particular expression, I found [experimentally] &lt;br&gt;
that there were generally two real numeric solutions (at least to within &lt;br&gt;
machine precision), and it was not clear that the lowest positive value &lt;br&gt;
would always be the desired solution.</description>
    </item>
  </channel>
</rss>
