<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250117</link>
    <title>MATLAB Central Newsreader - Combine several matrices for surf plotting</title>
    <description>Feed for thread: Combine several matrices for surf plotting</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>Tue, 28 Apr 2009 18:04:01 -0400</pubDate>
      <title>Combine several matrices for surf plotting</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/250117#645952</link>
      <author>Alexander </author>
      <description>Hi, &lt;br&gt;
&lt;br&gt;
let's say I have two different objects: the first one is a cylinder created with the cylinder command. Its x-y-z matrices are X1, Y1, Z1&lt;br&gt;
&lt;br&gt;
The second one is a torus with the matrices X2, Y2, Z2, created with loops like this (just for demonstration - the loops actually do not matter now):&lt;br&gt;
&lt;br&gt;
X2 = cos(phi) ;&lt;br&gt;
Y2 = sin(phi) ;&lt;br&gt;
Z2 = r * sin(phi) * ones(size(theta)) ;&lt;br&gt;
&lt;br&gt;
I can plot each of them with surf(Xi, Yi, Zi). But I would like to plot both of them in one plot. How could I do that?&lt;br&gt;
&lt;br&gt;
Suppose I had a combined matrices Xc, Yc, Zc. Then surf(Xc, Yc, Zc) would give me a picture of both the torus and the cylinder. Now, if I wanted to e.g. change the position or rotation of one of the object, let's say the cylinder, I would just change the approporiate coordinates within the Xc, Yc, and Zc matrices. Naturally, I would leave those coordinates which concern the torus untouched. &lt;br&gt;
&lt;br&gt;
Just if you're interested why I'm asking this:&lt;br&gt;
I would like to create a simulation of a spinning top (for simplicity, it might be won from the cylinder command) with its Cardan suspension frames (they are half-torus like). Now, the suspension moves differently from the top which it holds. I might have the big matrices Xc, Yc, and Zc containing all the data about the top and every suspension frame. Then, I would (frame by frame) rotate the top and each frame individually. I'd do that by changing the appropriate parts of the Xc, Yc, Zc matrix. Then I would update the surf plot with the new matrices Xc, Yc, Zc. This would animate my spinning top. I finished the program for the mere top already, and now I would like to implement the Cardan suspension frames.&lt;br&gt;
&lt;br&gt;
I'm looking forward to your replies!&lt;br&gt;
&lt;br&gt;
Alexander</description>
    </item>
  </channel>
</rss>

