フィルターのクリア

Error using vertcat and how to solve it?

11 ビュー (過去 30 日間)
Md. Golam Zakaria
Md. Golam Zakaria 2023 年 2 月 7 日
編集済み: Stephen23 2023 年 2 月 7 日
Hello everyone, I am getting Error using vertcat, Dimensions of arrays being concatenated are not consistent, error for the following code. Can anyone please point me out my error and how to fix it.
clc
clear all
f = @(t,x) [-x(4)-(0.424)+(1.6977)*exp(-1.35*10^20*(x(1)^2));
x(4)-(0.663)+(2.6540)*exp(-1.35*10^20*(x(2)^2));
-(2.994*10^5)*x(4);
(7.124*10^17*(x(1)^2)-7.124*10^17*(x(2)^2)+x(3)+60*(cos(t))) -2.55*10^7*x(4)];
[t,xa] = ode45(f,[0, 80],[0,0,-62,0]);

採用された回答

Stephen23
Stephen23 2023 年 2 月 7 日
編集済み: Stephen23 2023 年 2 月 7 日
f = @(t,x) [-x(4)-(0.424)+(1.6977)*exp(-1.35*10^20*(x(1)^2));
x(4)-(0.663)+(2.6540)*exp(-1.35*10^20*(x(2)^2));
-(2.994*10^5)*x(4);
(7.124*10^17*(x(1)^2)-7.124*10^17*(x(2)^2)+x(3)+60*(cos(t)))-2.55*10^7*x(4)];
% ^^ removed space character
A space character is a delimiter that separates elements horizontally, equivalent to a comma. Because of that space character you were trying to concatenate rows together which had [1,1,1,2] columns. Clearly that doesn't work.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by