Error R_tilde = builtin('s​ubsref',L_​tilde,Idx)​;

53 次查看(过去 30 天)
clc;
clear all
syms x y F(y)
f(y)=(10./3).*((x).*(y.^(2./5)));
eqn=diff(F(y))==f(y);
cond = [y(0) == 4];
Array indices must be positive integers or logical values.

Error in indexing (line 1075)
R_tilde = builtin('subsref',L_tilde,Idx);
sol=vpa (dsolve(eqn,cond))
I am Receving these errors.
Subscript indices must either be real positive integers or logicals.
R_tilde = builtin('subsref',L_tilde,Idx);
cond = [y(0) == 4];

回答(1 个)

Cris LaPierre
Cris LaPierre 2022-8-23
The error is because y is a variable, not a function, so y(0) is being treated as an indexing operation. Since MATLAB uses 1-based indexing, it is returning an error. Perhaps you meant to write f(0) in your condition statement?
y=1:3;
% works
y(2)
ans = 2
% your error
y(0)
Array indices must be positive integers or logical values.

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by