MATLAB Newsgroup

Hi guys, I have this code. I plotted these points already. How to i get the lines to move/animate in 360 degree motion, assuming all the variables have known values stored in a master file? This is my code of for a six bar mchanism. Thanks.

pos_r1x = r1*cos(theta_1); %position vector of r1

pos_r1y = r1*sin(theta_1);

pos_r1 = [pos_r1x,pos_r1y];

pos_r2x = r2*cos(theta_2);

pos_r2y = r2*sin(theta_2);

pos_r2 = [pos_r2x,pos_r2y];

pos_r3x = pos_r2x + r3*cos(theta_3);

pos_r3y = pos_r2y + r3*sin(theta_3);

pos_r3 = [pos_r3x,pos_r3y];

pos_r4x = pos_r1x + r4*cos(theta_4);

pos_r4y = pos_r1y + r4*sin(theta_4);

pos_r4 = [pos_r4x,pos_r4y];

pos_r5x = pos_r1x + r5*cos(theta_5);

pos_r5y = pos_r1y + r5*sin(theta_5);

pos_r5 = [pos_r5x,pos_r5y];

pos_r6x = pos_r1x + r6*cos(theta_6);

pos_r6y = pos_r1y + r6*sin(theta_6);

pos_r6 = [pos_r6x,pos_r6y];

pos_r7x = pos_r6x + r7*cos(theta_7);

pos_r7y = pos_r6y + r7*sin(theta_7);

pos_r7 = [pos_r7x,pos_r7y];

pos_r8x = pos_r5x + r8*cos(theta_8);

pos_r8y = pos_r5y + r8*sin(theta_8);

pos_r8 = [pos_r8x,pos_r8y];

pos_rpx = pos_r6x + rp*cos(beta-(theta_7));

pos_rpy = pos_r6y + rp*sin(beta-(theta_7));

pos_rp = [pos_rpx,pos_rpy];

x1 = [0 pos_r2x pos_r3x pos_r1x]; %I just grouped all the points to get the proper

y1 = [0 pos_r2y pos_r3y pos_r1y]; %configiration of my graph

x2 = [pos_r1x pos_r4x pos_r6x pos_r1x];

y2 = [pos_r1y pos_r4y pos_r6y pos_r1y];

x3 = [pos_r1x pos_r6x pos_r7x pos_r5x];

y3 = [pos_r1y pos_r6y pos_r7y pos_r5y];

xp = [pos_r6x pos_rpx pos_r7x];

yp = [pos_r6y pos_rpy pos_r7y];

plot(x1,y1,'-bo','LineWidth',1.5,...

'MarkerEdgeColor','r',...

'MarkerFaceColor','r',...

'MarkerSize',5);

hold on;

plot(x2,y2,'-bo','LineWidth',1.5,...

'MarkerEdgeColor','r',...

'MarkerFaceColor','r',...

'MarkerSize',5);

hold on;

plot(x3,y3,'-bo','LineWidth',1.5,...

'MarkerEdgeColor','r',...

'MarkerFaceColor','r',...

'MarkerSize',5);

hold on;

plot(xp,yp,'-bo','LineWidth',1.5,...

'MarkerEdgeColor','r',...

'MarkerFaceColor','r',...

'MarkerSize',5);

Hi Ben,

KUL I suppose?

Write down your bars as vectors; (starting position) + amplitude*exp

(j*omega(t))

(with (starting position) the position from where the vector is

defined)

Put these definitions in a for-loop: eg. for k =3D 1:length(omega), and

also plot the vectors (real, imag) in this for-loop, always is the

same figure. Clear the figure before the first vector in the new loop:

use 'cla'.

hth!

Pieter

On 26 mrt, 22:40, "Ben " <benlawr2...@yahoo.com> wrote:

> Hi guys, I have this code. =A0I plotted these points already. =A0How to i=

get the lines to move/animate in 360 degree motion, assuming all the varia=

bles have known values stored in a master file? =A0 This is my code of for =

a six bar mchanism. =A0Thanks.

>

> pos_r1x =3D r1*cos(theta_1); %position vector of r1

> pos_r1y =3D r1*sin(theta_1);

> pos_r1 =3D [pos_r1x,pos_r1y];

>

> pos_r2x =3D r2*cos(theta_2);

> pos_r2y =3D r2*sin(theta_2);

> pos_r2 =3D [pos_r2x,pos_r2y];

>

> pos_r3x =3D pos_r2x + r3*cos(theta_3);

> pos_r3y =3D pos_r2y + r3*sin(theta_3);

> pos_r3 =3D [pos_r3x,pos_r3y];

>

> pos_r4x =3D pos_r1x + r4*cos(theta_4);

> pos_r4y =3D pos_r1y + r4*sin(theta_4);

> pos_r4 =3D [pos_r4x,pos_r4y];

>

> pos_r5x =3D pos_r1x + r5*cos(theta_5);

> pos_r5y =3D pos_r1y + r5*sin(theta_5);

> pos_r5 =3D [pos_r5x,pos_r5y];

>

> pos_r6x =3D pos_r1x + r6*cos(theta_6);

> pos_r6y =3D pos_r1y + r6*sin(theta_6);

> pos_r6 =3D [pos_r6x,pos_r6y];

>

> pos_r7x =3D pos_r6x + r7*cos(theta_7);

> pos_r7y =3D pos_r6y + r7*sin(theta_7);

> pos_r7 =3D [pos_r7x,pos_r7y];

>

> pos_r8x =3D pos_r5x + r8*cos(theta_8);

> pos_r8y =3D pos_r5y + r8*sin(theta_8);

> pos_r8 =3D [pos_r8x,pos_r8y];

>

> pos_rpx =3D pos_r6x + rp*cos(beta-(theta_7));

> pos_rpy =3D pos_r6y + rp*sin(beta-(theta_7));

> pos_rp =3D [pos_rpx,pos_rpy];

>

> x1 =3D [0 pos_r2x pos_r3x pos_r1x]; %I just grouped all the points to get=

the proper

> y1 =3D [0 pos_r2y pos_r3y pos_r1y]; %configiration of my graph

>

> x2 =3D [pos_r1x pos_r4x pos_r6x pos_r1x];

> y2 =3D [pos_r1y pos_r4y pos_r6y pos_r1y];

>

> x3 =3D [pos_r1x pos_r6x pos_r7x pos_r5x];

> y3 =3D [pos_r1y pos_r6y pos_r7y pos_r5y];

>

> xp =3D [pos_r6x pos_rpx pos_r7x];

> yp =3D [pos_r6y pos_rpy pos_r7y];

>

> =A0 =A0 plot(x1,y1,'-bo','LineWidth',1.5,...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerEdgeColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerFaceColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerSize',5);

> =A0 =A0 hold on;

> =A0 =A0 plot(x2,y2,'-bo','LineWidth',1.5,...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerEdgeColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerFaceColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerSize',5);

> =A0 =A0 hold on;

> =A0 =A0 plot(x3,y3,'-bo','LineWidth',1.5,...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerEdgeColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerFaceColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerSize',5);

> =A0 =A0 hold on;

> =A0 =A0 plot(xp,yp,'-bo','LineWidth',1.5,...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerEdgeColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerFaceColor','r',...

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 'MarkerSize',5);

You can think of your watch list as threads that you have bookmarked.

You can add tags, authors, threads, and even search results to your watch list. This way you can easily keep track of topics that you're interested in. To view your watch list, click on the "My Newsreader" link.

To add items to your watch list, click the "add to watch list" link at the bottom of any page.

To add search criteria to your watch list, search for the desired term in the search box. Click on the "Add this search to my watch list" link on the search results page.

You can also add a tag to your watch list by searching for the tag with the directive "tag:tag_name" where tag_name is the name of the tag you would like to watch.

To add an author to your watch list, go to the author's profile page and click on the "Add this author to my watch list" link at the top of the page. You can also add an author to your watch list by going to a thread that the author has posted to and clicking on the "Add this author to my watch list" link. You will be notified whenever the author makes a post.

To add a thread to your watch list, go to the thread page and click the "Add this thread to my watch list" link at the top of the page.

Got questions?

Get answers.

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

Learn moreDiscover what MATLAB ^{®} can do for your career.

Opportunities for recent engineering grads.

Apply TodayThe newsgroups are a worldwide forum that is open to everyone. Newsgroups are used to discuss a huge range of topics, make announcements, and trade files.

Discussions are threaded, or grouped in a way that allows you to read a posted message and all of its replies in chronological order. This makes it easy to follow the thread of the conversation, and to see what’s already been said before you post your own reply or make a new posting.

Newsgroup content is distributed by servers hosted by various organizations on the Internet. Messages are exchanged and managed using open-standard protocols. No single entity “owns” the newsgroups.

There are thousands of newsgroups, each addressing a single topic or area of interest. The MATLAB Central Newsreader posts and displays messages in the comp.soft-sys.matlab newsgroup.

**MATLAB Central**

You can use the integrated newsreader at the MATLAB Central website to read and post messages in this newsgroup. MATLAB Central is hosted by MathWorks.

Messages posted through the MATLAB Central Newsreader are seen by everyone using the newsgroups, regardless of how they access the newsgroups. There are several advantages to using MATLAB Central.

**One Account**

Your MATLAB Central account is tied to your MathWorks Account for easy access.

**Use the Email Address of Your Choice**

The MATLAB Central Newsreader allows you to define an alternative email address as your posting address, avoiding clutter in your primary mailbox and reducing spam.

**Spam Control**

Most newsgroup spam is filtered out by the MATLAB Central Newsreader.

**Tagging**

Messages can be tagged with a relevant label by any signed-in user. Tags can be used as keywords to find particular files of interest, or as a way to categorize your bookmarked postings. You may choose to allow others to view your tags, and you can view or search others’ tags as well as those of the community at large. Tagging provides a way to see both the big trends and the smaller, more obscure ideas and applications.

**Watch lists**

Setting up watch lists allows you to be notified of updates made to postings selected by author, thread, or any search variable. Your watch list notifications can be sent by email (daily digest or immediate), displayed in My Newsreader, or sent via RSS feed.

- Use a newsreader through your school, employer, or internet service provider
- Pay for newsgroup access from a commercial provider
- Use Google Groups
- Mathforum.org provides a newsreader with access to the comp.soft sys.matlab newsgroup
- Run your own server. For typical instructions, see: http://www.slyck.com/ng.php?page=2