my graph is not showing....please help
4 次查看(过去 30 天)
显示 更早的评论
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
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
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
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!