my graph is not showing....please help

조회 수: 10 (최근 30일)
Mohammad Jawad
Mohammad Jawad 2020년 10월 28일
편집: Elijah McNeil 2020년 10월 28일
Hi there, im designing lobes for a gerotor and i inputted a code on matlab but the graph is not showing up.
This is tyhe first part of my code only:
%% Geometry Of Pump
%% Inizialisation
N_o = 5;
N_i = 4;
v = 0.6;
D =1;
E = D/(2*(N_o + 2*v));
re = v*E;
rh = E-re;
rp_o = D/2 - (2*re);
rp_i = rp_o*(N_i/N_o);
theta_e = (-2*pi/N_o)*(re/E);
theta_h = 0;
xe = -(rp_o + re)*sin(theta_e) + re*sin(theta_e*((rp_o/re) +1));
ye = (rp_o + re)*cos(theta_e) - re*cos(theta_e*((rp_o/re) +1));
ye = xe +1;
plot(xe, ye)
for theta_e = -(2*pi/N_o)*(re/E):0
[theta_e,rp_o] = pol2cart(xe,ye);
xe = -(rp_o + re)*sin(theta_e) + re*sin(theta_e*((rp_o/re) +1));
ye = (rp_o + re)*cos(theta_e) - re*cos(theta_e*((rp_o/re) +1));
theta_e = theta_e +1;
end
plot(theta_e,rp_o)
  댓글 수: 4
Elijah McNeil
Elijah McNeil 2020년 10월 28일
I'm not very strong in MATLAB either, but I know that you can use "hold on, off" to plot both points onto the same graph.
hold on
plot(theta_e,rp_o,'o')
hold off
If you need more than those points, you will probaly have to rewrite your code, or mabye someone with more experience will answer you.
Elijah McNeil
Elijah McNeil 2020년 10월 28일
ye = (rp_o + re)*cos(theta_e) - re*cos(theta_e*((rp_o/re) +1));
ye = xe +1;
Which one of these lines of code do you need, because the 2nd one writes a new value for ye.

댓글을 달려면 로그인하십시오.

답변 (1개)

Elijah McNeil
Elijah McNeil 2020년 10월 28일
편집: Elijah McNeil 2020년 10월 28일
E = 1/(2*(5 + 2*0.6));
re = 0.6*E;
rh = E-re;
rp_o = 1/2 - (2*re);
rp_i = rp_o*(4/5);
theta_e = (-2*pi/5)*(re/E);
theta_h = 0;
xe = -(rp_o + re)*sin(theta_e) + re*sin(theta_e*((rp_o/re) +1));
ye = (rp_o + re)*cos(theta_e) - re*cos(theta_e*((rp_o/re) +1));
plot(xe, ye,'o')
for theta_e = -(2*pi/N_o)*(re/E):0
[theta_e,rp_o] = pol2cart(xe,ye);
xe = -(rp_o + re)*sin(theta_e) + re*sin(theta_e*((rp_o/re) +1));
ye = (rp_o + re)*cos(theta_e) - re*cos(theta_e*((rp_o/re) +1));
theta_e = theta_e +1;
end
hold on
plot(theta_e,rp_o,'o')
hold off
This is assuming that you don't need this line of code:
ye = xe +1;
If you needed that line of code, then just sub it in for:
ye = (rp_o + re)*cos(theta_e) - re*cos(theta_e*((rp_o/re) +1));
Also, if you have variables that are scalars, you don't really need to include that variable, as it just takes more time to write.

카테고리

Help CenterFile Exchange에서 Graphics Performance에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by