Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Ploting

Subject: Ploting

From: kaleigh

Date: 2 Aug, 2010 03:43:07

Message: 1 of 4

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.

Subject: Ploting

From: Roger Stafford

Date: 2 Aug, 2010 04:54:03

Message: 2 of 4

"kaleigh " <itsmeklee14@yahoo.com> wrote in message <i35esb$7q4$1@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

Subject: Ploting

From: William

Date: 2 Aug, 2010 05:01:05

Message: 3 of 4

Is the vector 'A' significant to somthing? Was it just a matrix you need to recreate?

Subject: Ploting

From: Ross W

Date: 2 Aug, 2010 06:56:02

Message: 4 of 4

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <i35j1b$pal$1@fred.mathworks.com>...
> "kaleigh " <itsmeklee14@yahoo.com> wrote in message <i35esb$7q4$1@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

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us