hello, i m facing problem to plot all columns of an array in same plot inside for loop.what my code doing is it's executing the value of last column of desired array.the array columns should plot curves for y axis.in code array - 'fxl'
Afficher commentaires plus anciens
clc;
fz1 = 1000;
fz2 = 1100;
step = 50;
gamma = -1;
gamma = gamma*(3.14/180);% converting into radians
pihix1 = +0.000e+000;
pihix2 = +0.000e+000;
pivix1 = +0.000e+000;
pivix2 = +0.000e+000;
picix1 = -0.786e+000;
pidix1 = -0.860e+000;
pidix2 = -5.540e-001;
pidix3 = +1.223e+001;
pieix1 = 68.570e-001;
pieix2 = -3.800e-002;
pieix3 = +0.000e+000;
pieix4 = +7.170e-002;
pikix1 = -68.125e+001;
pikix2 = 12.025e+001;
pikix3 = +0.000e-001;
for fz = fz1:step:(fz2)
disp(fz)
fxl = [];
kappal = [];
fz0 = 800;
dfz = (fz - fz0)/fz0;
R0 = 0.235;
disp(dfz)
for kappa = -0.25:0.01:0.25
y = pikix2+ pikix3;
sihix = pihix1 + pihix2*dfz;
sivix = fz*pivix1 + pivix2*dfz;
kappax = (kappa) + sihix;
cx = picix1;
mux = (pidix1 + (pidix2*dfz))*(1 - (pidix3*dfz)*(gamma^2));
dx = mux*fz;
ex = (pieix1 + pieix2*dfz + (pieix3*(dfz^2)))*(1 - ((pieix4)*(sign(kappax))));
kx = fz*pikix1 + ((pikix2*dfz)*exp(pikix3*dfz));
bx = (kx)/(cx*dx);
fx0 = dx*sin((cx*atan(bx*kappax - ex*(bx*kappax - atan(bx*kappax)))) + sivix);
fxl = cat(1,fxl,fx0) %desired array containg columns which need to be plotted
kappal = cat(1,kappal,kappax);
end
plot(kappal,fxl)
xlabel('Sa')
ylabel('fx')
grid on
end
%code executes this graph

%desired output

Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Scatter Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!