I plotted a curve by putting 3 loops in it.I got the plot but while trying to take the out put to the excel sheet am getting only the random values.How to solve this issue
Afficher commentaires plus anciens
for t = 1:1:5 for j = 6:1:10 for k = 11:1:P-1 Xt = [x(t) x(t+1)]; Yt = [y(t) y(t+1)]; Xj = [x(j) x(j+1)]; Yj = [y(j) y(j+1)]; Xk = [x(k) x(k+1)]; Yk = [y(k) y(k+1)];
X1t = [x1(t) x1(t+1)];
Y1t = [y1(t) y1(t+1)];
X1j = [x1(j) x1(j+1)];
Y1j = [y1(j) y1(j+1)];
X1k = [x1(k) x1(k+1)];
Y1k = [y1(k) y1(k+1)];
Xit = mean(Xt)+.36;
Yit = mean(Yt)+.4;
Xij = mean(Xj)+.8;
Yij = mean(Yj)+.4;
Xik = mean(Xk)+1.1;
Yik = mean(Yk)+.4;
Xi1t = mean(X1t)+.36;
Yi1t = mean(Y1t)+.4;
Xi1j = mean(X1j)+.8;
Yi1j = mean(Y1j)+.4;
Xi1k = mean(X1k)+1.1;
Yi1k = mean(Y1k)+.4;
Xat = [Xt(1) Xit Xt(2)];
Yat = [Yt(1) Yit Yt(2)];
Xaj = [Xj(1) Xij Xj(2)];
Yaj = [Yj(1) Yij Yj(2)];
Xak = [Xk(1) Xik Xk(2)];
Yak = [Yk(1) Yik Yk(2)];
Xa1t = [X1t(1) Xi1t X1t(2)];
Ya1t = [Y1t(1) Yi1t Y1t(2)];
Xa1j = [X1j(1) Xij X1j(2)];
Ya1j = [Y1j(1) Yi1j Y1j(2)];
Xa1k = [X1k(1) Xi1k X1k(2)];
Ya1k = [Y1k(1) Yi1k Y1k(2)];
Tt = 1:numel(Xat);
Tj = 1:numel(Xaj);
Tk = 1:numel(Xak);
T1t = 1:numel(Xa1t);
T1j = 1:numel(Xa1j);
T1k = 1:numel(Xa1k);
tst = linspace(min(Tt),max(Tt),numel(Xat)*1000);
tsj = linspace(min(Tj),max(Tj),numel(Xaj)*1000);
tsk = linspace(min(Tk),max(Tk),numel(Xak)*1000);
tst1 = linspace(min(T1t),max(T1t),numel(Xa1t)*1000);
tsj1 = linspace(min(T1j),max(T1j),numel(Xa1j)*1000);
tsk1 = linspace(min(T1k),max(T1k),numel(Xa1k)*1000);
xxt = spline(Tt,Xat,tst);
yyt = spline(Tt,Yat,tst);
xxj = spline(Tj,Xaj,tsj);
yyj = spline(Tj,Yaj,tsj);
xxk = spline(Tk,Xak,tsk);
yyk = spline(Tk,Yak,tsk);
xxt1 = spline(T1t,Xa1t,tst1);
yyt1 = spline(T1t,Ya1t,tst1);
xxj1 = spline(T1j,Xa1j,tsj1);
yyj1 = spline(T1j,Ya1j,tsj1);
xxk1 = spline(T1k,Xa1k,tsk1);
yyk1 = spline(T1k,Ya1k,tsk1);
plot(yyt,xxt); hold on;
plot(yyj,xxj); hold on;
plot(yyk,xxk); hold on;
plot(yyt1,xxt1); hold on;
plot(yyj1,xxj1); hold on;
plot(yyk1,xxk1); hold on;
end
end
end
Réponses (1)
John Petersen
le 4 Jan 2014
0 votes
use fprintf or diary
Catégories
En savoir plus sur Elementary Math 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!