필터 지우기
필터 지우기

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

조회 수: 53 (최근 30일)
Fahad Ramzan
Fahad Ramzan 2021년 4월 12일
답변: Cris LaPierre 2022년 8월 23일
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