Filter löschen
Filter löschen

my graph is not showing....please help

4 Ansichten (letzte 30 Tage)
Mohammad Jawad
Mohammad Jawad am 28 Okt. 2020
Bearbeitet: Elijah McNeil am 28 Okt. 2020
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 Kommentare
Elijah McNeil
Elijah McNeil am 28 Okt. 2020
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 am 28 Okt. 2020
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Elijah McNeil
Elijah McNeil am 28 Okt. 2020
Bearbeitet: Elijah McNeil am 28 Okt. 2020
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.

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by