Output data to text file
Afficher commentaires plus anciens
I have this code
H = 1;
h = 15;
l = 500;
g = 9.81;
n1 = 1;
n2 = 2;
n3 = 3;
L1 = (2*l)/n1;
L2 = (2*l)/n2;
L3 = (2*l)/n3;
T1 = (2*l)/(n1*sqrt(g*h));
T2 = (2*l)/(n2*sqrt(g*h));
T3 = (2*l)/(n3*sqrt(g*h));
t = 0;
x = 0:10:l;
k1 = (2*pi)/L1;
k2 = (2*pi)/L2;
k3 = (2*pi)/L3;
sigma1 = sqrt(g*k1*tanh(k1*h));
sigma2 = sqrt(g*k2*tanh(k2*h));
sigma3 = sqrt(g*k3*tanh(k3*h));
eta1 = (H/2)*cos(k1*x)*cos(sigma1*t);
eta2 = (H/2)*cos(k2*x)*cos(sigma2*t);
eta3 = (H/2)*cos(k3*x)*cos(sigma3*t);
figure
hold on
subplot(3,1,1);
plot(x,eta1)
title('n = 1');
subplot(3,1,2);
plot(x,eta2)
title('n = 2')
subplot(3,1,3);
plot(x,eta3)
title('n = 3');
I need to output the data into 3 text files with 2 columns where x = 1,2,3 for three modes respectfully. (n =1,2,3 are modes). How would I go about this?
1 commentaire
stozaki
le 28 Sep 2021
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Text Files 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!