How to remove matrix dimension exceeds issue.

7 Ansichten (letzte 30 Tage)
Zain
Zain am 25 Mai 2021
Bearbeitet: Zain am 25 Mai 2021
How to remove matrix dimension exceeds issue.

Antworten (1)

Luis FigueroaFernandez
Luis FigueroaFernandez am 25 Mai 2021
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 Kommentare
Zain
Zain am 25 Mai 2021
Still not working.
Luis FigueroaFernandez
Luis FigueroaFernandez am 25 Mai 2021
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

Melden Sie sich an, um zu kommentieren.

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by