Azzera filtri
Azzera filtri

Error using plotyy in for loop

1 visualizzazione (ultimi 30 giorni)
Anees khan
Anees khan il 21 Feb 2016
Commentato: Anees khan il 24 Feb 2016
i am trying to plot a graph in a for loop using hold on command. When i use simple plot (x,y) command graphs works well. But when i use plotyy command the same values the graph get distorted. Please guide
E1=30e6;
E2=.75e6;
G12=0.375e6;
v12=0.25;
hold on
for x=0:0.5:90
Ex=1/((1/E1*cosd(x).^4)+((1/G12-2*v12/E1)*(sind(x).^2)*(cosd(x).^2))+(1/E2*sind(x).^4));
vxy=Ex*(v12/E1*(sind(x).^4+cosd(x).^4)-(1/E1+1/E2-1/G12)*sind(x).^2*cosd(x).^2)
plotyy (x,Ex/E2,x,vxy)
end
hold off

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 21 Feb 2016
E1=30e6;
E2=.75e6;
G12=0.375e6;
v12=0.25;
x=0:0.5:90
Ex=1./((1./E1*cosd(x).^4)+((1./G12-2*v12/E1).*(sind(x).^2).*(cosd(x).^2))+(1./E2*sind(x).^4))
vxy=Ex.*(v12./E1.*(sind(x).^4+cosd(x).^4)-(1/E1+1/E2-1/G12).*sind(x).^2.*cosd(x).^2);
plotyy (x,Ex/E2,x,vxy)

Più risposte (0)

Categorie

Scopri di più su Two y-axis in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by