csvファイルのデータを用いた計算

4 vues (au cours des 30 derniers jours)
SHOTA TOMIYAMA
SHOTA TOMIYAMA le 25 Mai 2021
Réponse apportée : Naoya le 28 Mai 2021
function xt = Displacementforced(t,x)
m = 1;
k = 1;
c =0.2;
a = 0.005;
omega = 1;
xt = [x(2);-c/m.*(x(2)-a*omega*cos(omega*t))-k/m.*(x(1)-a*sin(omega*t))]
x0 = [0;0];
t = [0:0.1:30];
[T X] = ode45('Displacementforced',t,x0);
plot(T,X);
xlabel('time[s]')
ylabel('displacement[m]/velocity[m/s]')
legend('displacement','velocity')
上記のようなばねマスモデルを作成しました.
a*omega*cos(omega*t),a*sin(omega*t)にあたる部分を実験で測定したデータを使用したプログラムに変更したいです.測定データはcsvファイルとなっています.
データのインポートをしてそのまま式にいれたのですが変数が認識されませんとなってしまいました.

Réponse acceptée

Naoya
Naoya le 28 Mai 2021
ユーザが定義した時刻歴データ(点列のデータ)を微分方程式の外部入力とする場合に該当すると思われますが、関連記事が下記にございますので、一度ご参考頂ければと思います。
上記記事の "2.ode45 等の微分方程式を解く関数を用いる方法" の部分が該当します。
こちらの例では、ユーザが定義した時刻歴データが正弦波の例となっており、こちらをそのまま積分した例となっておりますが、方法としては同じことになります。

Plus de réponses (0)

Catégories

En savoir plus sur プログラミング dans Help Center et File Exchange

Tags

Produits

Community Treasure Hunt

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

Start Hunting!