WhatsApp can i do to plot the fonction below respect to the variables x and t

1 vue (au cours des 30 derniers jours)
When i run the code the following error apear
Index exceeds Matrix dimension

Réponse acceptée

Sam Chak
Sam Chak le 19 Mai 2022
Are you trying to plot something like this?
C = [];
X = linspace(0,1,25);
T = linspace(0,10,250);
for i = 1:length(X)
for j = 1:length(T)
C(i,j) = exp(-(1/2)*X(i))*((0.5e-3*exp(-182.4229*T(j))-0.24e-2*exp(-104.1124*T(j))+.4162*exp(-1.6659*T(j))-.1053*exp(-14.2761*T(j))+0.87e-2*exp(-48.3112*T(j)))*(.5449591281*cos(.4928312111*X(i))+1.492792677*sin(.4928312111*X(i))))...
+(-0.8e-3*exp(-182.4229*T(j))+0.22e-2*exp(-104.1124*T(j))-0.155e-1*exp(-1.6659*T(j))+.1858*exp(-14.2761*T(j))-0.239e-1*exp(-48.3112*T(j)))*(1.227596366*cos(3.450769558*X(i))+.4802566691*sin(3.450769558*X(i)))...
+(0.9e-3*exp(-182.4229*T(j))-0.101e-1*exp(-104.1124*T(j))+0.3e-3*exp(-1.6659*T(j))-0.133e-1*exp(-14.2761*T(j))+0.596e-1*exp(-48.3112*T(j)))*(1.370614035*cos(6.412844*X(i))+.2885348446*sin(6.412844*X(i)))...
+(-0.47e-2*exp(-182.4229*T(j))+0.272e-1*exp(-104.1124*T(j))-0.3e-3*exp(-1.6659*T(j))+0.7e-3*exp(-14.2761*T(j))-0.44e-2*exp(-48.3112*T(j)))*(1.384197996*cos(9.546645839*X(i))+.1957407164*sin(9.546645839*X(i)))...
+(0.123e-1*exp(-182.4229*T(j))-0.18e-2*exp(-104.1124*T(j))-0.7e-3*exp(-14.2761*T(j))+0.4e-3*exp(-48.3112*T(j)))*(1.396843135*cos(12.65883563*X(i))+.1489661678*sin(12.65883563*X(i)));
end
end
plot(X, C(:,22), 'bo', X, C(:,32), 'mo', X, C(:,42), 'co', X, C(:,53), 'go', X, C(:,63), 'ro')

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Produits


Version

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by