Prev: cDAQ 9172
Next: DAQ, cDAQ-9172, NI 9205 modules
From: kaleigh on 1 Aug 2010 23:43 I am trying to plot something in matlab and cannot get anything but the axis showing up.. I have a 6x6 matrix with sind(i) and cosd(i) in it, where i is an angle I need to vary from 0 to 30 degrees. My code I am using is for i = 0:1:30 A= [-1 0 0 0 0 1; 0 -1 0 1 0 0; -1 0 1 0 1 0; (.3*(cosd(i))) 0 0 0 0 0; ((-.3*(sind(i))+.4)) 0 0 0 .8 0; (.3*(cosd(i))) 0 0 -.8 0 0]; C = [0; 0; 981; 98.1; 490.5; 0]; D=inv(A); F=D*C; plot(F(6,:),i); end Where F= [P, Ryb, Rzb, Rya, Rza, Rxa] and I need the plot of Rxa verse i (0-30 degrees). I am not very familiar with matlab so this maybe completely wrong but please help.
From: Roger Stafford on 2 Aug 2010 00:54 "kaleigh " <itsmeklee14(a)yahoo.com> wrote in message <i35esb$7q4$1(a)fred.mathworks.com>... > I am trying to plot something in matlab and cannot get anything but the axis showing up.. > > I have a 6x6 matrix with sind(i) and cosd(i) in it, where i is an angle I need to vary from 0 to 30 degrees. My code I am using is > > for i = 0:1:30 > A= [-1 0 0 0 0 1; 0 -1 0 1 0 0; -1 0 1 0 1 0; (.3*(cosd(i))) 0 0 0 0 0; ((-.3*(sind(i))+.4)) 0 0 0 .8 0; (.3*(cosd(i))) 0 0 -.8 0 0]; > C = [0; 0; 981; 98.1; 490.5; 0]; > D=inv(A); > F=D*C; > plot(F(6,:),i); > end > > Where F= [P, Ryb, Rzb, Rya, Rza, Rxa] and I need the plot of Rxa verse i (0-30 degrees). > > I am not very familiar with matlab so this maybe completely wrong but please help. - - - - - - - - - - - - You need to do a "hold on" so that the successive points plotted do not erase previous points. If you look carefully at your plot you should see the last surviving point there as a single tiny point for i = 30. Another way is to store successive values of Rxa in an array and do the plot on this array versus the array 0:30 . Roger Stafford
From: William on 2 Aug 2010 01:01 Is the vector 'A' significant to somthing? Was it just a matrix you need to recreate?
From: Ross W on 2 Aug 2010 02:56 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <i35j1b$pal$1(a)fred.mathworks.com>... > "kaleigh " <itsmeklee14(a)yahoo.com> wrote in message <i35esb$7q4$1(a)fred.mathworks.com>... > > I am trying to plot something in matlab and cannot get anything but the axis showing up.. > > > > I have a 6x6 matrix with sind(i) and cosd(i) in it, where i is an angle I need to vary from 0 to 30 degrees. My code I am using is > > > > for i = 0:1:30 > > A= [-1 0 0 0 0 1; 0 -1 0 1 0 0; -1 0 1 0 1 0; (.3*(cosd(i))) 0 0 0 0 0; ((-.3*(sind(i))+.4)) 0 0 0 .8 0; (.3*(cosd(i))) 0 0 -.8 0 0]; > > C = [0; 0; 981; 98.1; 490.5; 0]; > > D=inv(A); > > F=D*C; > > plot(F(6,:),i); > > end > > > > Where F= [P, Ryb, Rzb, Rya, Rza, Rxa] and I need the plot of Rxa verse i (0-30 degrees). > > > > I am not very familiar with matlab so this maybe completely wrong but please help. > - - - - - - - - - - - - > You need to do a "hold on" so that the successive points plotted do not erase previous points. If you look carefully at your plot you should see the last surviving point there as a single tiny point for i = 30. > > Another way is to store successive values of Rxa in an array and do the plot on this array versus the array 0:30 . > > Roger Stafford In addition to Roger's suggestion, you might also consider replacing plot(F(6,:),i); by plot(F(6,:),i, 'o'); or some other marker. Read the help for plot to learn more... Cheers, Ross
|
Pages: 1 Prev: cDAQ 9172 Next: DAQ, cDAQ-9172, NI 9205 modules |