<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164497</link>
    <title>MATLAB Central Newsreader - quadratic form with symbolic vectors?</title>
    <description>Feed for thread: quadratic form with symbolic vectors?</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 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.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Mon, 25 Feb 2008 19:36:02 -0500</pubDate>
      <title>quadratic form with symbolic vectors?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164497#417221</link>
      <author>David Doria</author>
      <description>I would like to differentiate x'Ax.  Here my x is y-B*u and&lt;br&gt;
A is the identity matrix&lt;br&gt;
&lt;br&gt;
syms B u1 u2 y1 y2 real&lt;br&gt;
u=[u1; u2]&lt;br&gt;
y=[y1; y2]&lt;br&gt;
I=eye(2);&lt;br&gt;
pretty(diff((y-B*u)'*I*(y-B*u),B))&lt;br&gt;
&lt;br&gt;
I don't know how to interpret the output:&lt;br&gt;
&lt;br&gt;
-2 (y1~ - B~ u1~) u1~ - 2 (y2~ - B~ u2~) u2~&lt;br&gt;
&lt;br&gt;
what are all the tilda's for?  Am I doing this correctly?&lt;br&gt;
&lt;br&gt;
Thanks!&lt;br&gt;
&lt;br&gt;
David</description>
    </item>
    <item>
      <pubDate>Mon, 25 Feb 2008 20:05:28 -0500</pubDate>
      <title>Re: quadratic form with symbolic vectors?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164497#417226</link>
      <author>Ashish Uthama</author>
      <description>&lt;br&gt;
looks like 'pretty' is messing things up (or rather, I do not know how t=&lt;br&gt;
o  =&lt;br&gt;
&lt;br&gt;
interepret this..)&lt;br&gt;
&lt;br&gt;
&amp;gt;&amp;gt; (diff((y-B*u)'*I*(y-B*u),B))&lt;br&gt;
&lt;br&gt;
ans =3D&lt;br&gt;
&lt;br&gt;
-2*(y1-B*u1)*u1-2*(y2-B*u2)*u2&lt;br&gt;
&lt;br&gt;
(if you did not know, PRETTY just not change the answer, just tries to  =&lt;br&gt;
&lt;br&gt;
print the ans in a 'nice' way)&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Mon, 25 Feb 2008 14:36:02 -0500, David Doria &amp;lt;daviddoria@gmail.com&amp;gt;  =&lt;br&gt;
&lt;br&gt;
wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; syms B u1 u2 y1 y2 real&lt;br&gt;
&amp;gt; u=3D[u1; u2]&lt;br&gt;
&amp;gt; y=3D[y1; y2]&lt;br&gt;
&amp;gt; I=3Deye(2);&lt;br&gt;
&amp;gt; pretty(diff((y-B*u)'*I*(y-B*u),B))</description>
    </item>
    <item>
      <pubDate>Mon, 25 Feb 2008 20:28:01 -0500</pubDate>
      <title>Re: quadratic form with symbolic vectors?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164497#417231</link>
      <author>David Doria</author>
      <description>I did know that pretty tried to make it display nice, so&lt;br&gt;
then I guess question 1 is why does pretty put ~ all over??&lt;br&gt;
&lt;br&gt;
Then Question 2: If i run the following:&lt;br&gt;
&lt;br&gt;
--------&lt;br&gt;
%throughout, sigma = sigma^2&lt;br&gt;
clear;clc;close all;&lt;br&gt;
syms N sigma B u1 u2 y1 y2 real&lt;br&gt;
&lt;br&gt;
u=[u1; u2]&lt;br&gt;
y=[y1; y2]&lt;br&gt;
I = eye(2);&lt;br&gt;
%diff((y-B*u)'*I*(y-B*u),B)&lt;br&gt;
&lt;br&gt;
lnf = -N/2*log(2*pi) - N/2 * log(sigma) + -1/(2*sigma)*(y -&lt;br&gt;
B*u)'*(y-B*u);&lt;br&gt;
&lt;br&gt;
%first derivatives&lt;br&gt;
pretty(diff(lnf,B))&lt;br&gt;
&lt;br&gt;
--------&lt;br&gt;
&lt;br&gt;
it gives me the sum of 2 things, which are each the same&lt;br&gt;
because it should just be something in terms of a vector&lt;br&gt;
(the 2 components are what got broken up).  Is there a way&lt;br&gt;
for it to give back the result in vector form?&lt;br&gt;
&lt;br&gt;
Thanks,&lt;br&gt;
&lt;br&gt;
Dave</description>
    </item>
    <item>
      <pubDate>Tue, 26 Feb 2008 12:24:01 -0500</pubDate>
      <title>Re: quadratic form with symbolic vectors?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164497#417376</link>
      <author>David Doria</author>
      <description>am I doing something wrong? Or is this for some reason not&lt;br&gt;
supposed to work?&lt;br&gt;
bump</description>
    </item>
    <item>
      <pubDate>Tue, 26 Feb 2008 13:33:56 -0500</pubDate>
      <title>Re: quadratic form with symbolic vectors?</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/164497#417392</link>
      <author>Ashish Uthama</author>
      <description>My basic take is that the symbolic toolbox does not work with matrices as  &lt;br&gt;
you expect.&lt;br&gt;
looks like you have to deal with seperating each row&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
On Tue, 26 Feb 2008 07:24:01 -0500, David Doria &amp;lt;daviddoria@gmail.com&amp;gt;  &lt;br&gt;
wrote:&lt;br&gt;
&lt;br&gt;
&amp;gt; am I doing something wrong? Or is this for some reason not&lt;br&gt;
&amp;gt; supposed to work?&lt;br&gt;
&amp;gt; bump</description>
    </item>
  </channel>
</rss>

