MATLAB Giving "Dot indexing is not supported for variables of this type" Error When Attempting To Use Subs Function

5 ビュー (過去 30 日間)
Logan
Logan 2024 年 10 月 10 日
コメント済み: Voss 2024 年 10 月 10 日
Below is the code that I am using to answer a partial differentiation question. I am able to get all the way to the end of differentiation, but when attempting to substitute "x1,y1,z1" into the function "A" I get an error given as Dot indexing is not supported for variables of this type. Any help would be greatly appreciated. Thanks!
syms x y z t A
w = 8*y*exp(x)-log(z)
x1 = log(t^2+1)
y1 = cot(t)
z1 = exp(5*t)
Q1 = diff(w,x)
Q2 = diff(x1,1)
P1 = Q1*Q2
Q3 = diff(w,z)
Q4 = diff(z1,1)
P2 = Q3*Q4
Q5 = diff(w,y)
Q6 = diff(y1,1)
P3 = Q5*Q6
A = P1 + P2 + P3
R = vpa(subs(A,{x,y,z},{x1,y1.z1}),4)
Dot indexing is not supported for variables of this type.

Error in indexing (line 956)
R_tilde = builtin('subsref',L_tilde,Idx);

回答 (1 件)

Voss
Voss 2024 年 10 月 10 日
You have a period in the last line where you should have a comma. That is, "y1.z1" should be "y1,z1".
  2 件のコメント
Logan
Logan 2024 年 10 月 10 日
Thank you so much! I don't know how I missed that multiple times, and how my professor missed it as well...
Voss
Voss 2024 年 10 月 10 日
You're welcome! Any questions, let me know. Otherwise, please "Accept" this answer. Thanks!

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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by