tags:

views:

30

answers:

1

hello i have a problem in motion control in matlab imagine a four bar linkage mechanism like this.as you you know in an ordinary 4 bar linkage we have 2 fix points but here we have just one & the second one it fixed to a pinion (small gear).we have the ratio of gears so we have a relation between teta1 & teta2 teta2 = 5*teta1 (the mechanism can rotate in the first fix point)

i used to write this code for motion control but the when i run it the graphs are not correct (because they should be something linke sin or cos graph)

d(n) is a auxiliry vector for solving equations please ask if you have further questions

this is the code :

clc,
close all,
clear all,

ax=0;

ay=0;

r1=12;

r2=7;

r3=9;

r4=5;



n=0;

for teta1=0:pi/180:2*pi

    n=n+1;

D = r1*exp(i*teta1)-r2*exp(i*5*teta1);

tetad(n) = angle(D);

d(n) = abs(D);

landa(n)=acos((d(n)^2+(r3)^2-(r4)^2)/(2*d(n)*r3));

alfa(n)=acos((d(n)^2+(r4)^2-(r3)^2)/(2*d(n)*r4));

teta3(n)=landa(n)+tetad(n);

teta4(n)=(+pi-alfa(n)+tetad(n));

end



aa(n)=teta1*180/pi;

hh(n)=tetad(n)*180/pi;

bb(n)=landa(n)*180/pi;

cc(n)=alfa(n)*180/pi;

nn(n)=teta3(n)*180/pi;

dd(n)=5*teta1*180/pi;

ee(n)=teta4(n)*180/pi;


figure(1),plot(aa,hh),xlabel('teta1'),ylabel('tetad');

figure(2),plot(aa,d),xlabel('teta1'),ylabel('d');

figure(3),plot(aa,bb),xlabel('teta1'),ylabel('landa');

figure(4),plot(aa,cc),xlabel('teta1'),ylabel('alfa');

figure(5),plot(aa,nn),xlabel('teta1'),ylabel('teta3');

figure(6),plot(aa,dd),xlabel('teta1'),ylabel('5*teta1');

figure(7),plot(aa,ee),xlabel('teta1'),ylabel('teta4');
A: 

I have no idea what you are trying to solve here, but probably you want to move the end of your for-loop a few lines down, so the vectors you plot contain all values and not only the last one.

groovingandi
thanks my friend.my problem is solved now by your advise
one more problem is this error can you solve this :Warning: Imaginary parts of complex X and/or Y arguments ignored> In dynamic3 at 40Warning: Imaginary parts of complex X and/or Y arguments ignored> In dynamic3 at 41Warning: Imaginary parts of complex X and/or Y arguments ignored> In dynamic3 at 42Warning: Imaginary parts of complex X and/or Y arguments ignored> In dynamic3 at 44>>
If you want somebody to help you, I strongly suggest you put more effort into formatting your questions properly. From "dynamic3 at 41" I can only guess what line this relates to. Your `alfa` is complex, so plotting it creates a warning.
groovingandi
Btw. the greek letters are called theta, alpha and lambda!
groovingandi

related questions