Filter löschen
Filter löschen

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

53 Ansichten (letzte 30 Tage)
Fahad Ramzan
Fahad Ramzan am 12 Apr. 2021
Beantwortet: Cris LaPierre am 23 Aug. 2022
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];

Antworten (1)

Cris LaPierre
Cris LaPierre am 23 Aug. 2022
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.

Community Treasure Hunt

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

Start Hunting!

Translated by