How to remove matrix dimension exceeds issue.

How to remove matrix dimension exceeds issue.

1 件のコメント

Stephen23
Stephen23 2021 年 5 月 25 日
Do NOT use global variables, use an anymous function to pass extra parameters to the function:

サインインしてコメントする。

回答 (1 件)

Luis FigueroaFernandez
Luis FigueroaFernandez 2021 年 5 月 25 日

0 投票

Hi Zain,
Couple of things, first, I dont see 'y' defined within your lobal variables (which local variabler are not really recommended in good programming practices), and second, for you to use 'y' within a function you would have to share the variable while calling and receiving the function.
eg:
%Calling your function
[x,y] = solbasic(y)
%...
function [x,y] = solbasic(y)
global tspan x0 C T_wi
[~, x] = ode15s(@basic, tspan, x0);
y = x*C' + T_wi;
disp(y)
end

2 件のコメント

Zain
Zain 2021 年 5 月 25 日
Still not working.
Luis FigueroaFernandez
Luis FigueroaFernandez 2021 年 5 月 25 日
Yust checked again and you haven't declared 'y' at all. You have to create 'y' in your main code, you cannot share a variable that doesn't exist.
y = 0;
Before shaing it to the funcion

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeNumerical Integration and Differential Equations についてさらに検索

製品

質問済み:

2021 年 5 月 25 日

編集済み:

2021 年 5 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by