How to replace equations in symbolic function
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
Good Morning,
Please I have a function F = 3*a*b
Therefore how can i change (a*b) with a variable 'x' to obtain F = 3*x
Think you.
採用された回答
Birdman
2020 年 3 月 27 日
By using subs function:
syms a b x
F=3*a*b;
Fnew=subs(F,{a,b},{x,1})
9 件のコメント
Think you very much Bridman but don't work with my problem
beacause my problem that I have a function F = A*(q1^2) + B*(q2^2) + C*(q1*q2) + D*(q2*q3);
And I want change : (q1^2) with t1 / (q2^2) with t2 / (q1*q2) with t12 / (q2*q3) with t23
to obtain F = A*t1 + B*t2 + C*t12 + D*t23
Think you.
That 1 stands for replacing with b.
Your problem should be solved by the following code:
syms A B C D q1 q2 q3 t1 t2 t12 t23
F=A*q1^2+B*q2^2+C*q1*q2+D*q2*q3
%the following line does the trick
Fnew=subs(F,{q1^2,q2^2,q1*q2,q2*q3},{t1 t2 t12 t23})
Anis Frej
2020 年 3 月 27 日
I already did that but unfortunately does not work

Just t1 and t2 changes.
Birdman
2020 年 3 月 27 日
Which version of MATLAB are you using? I am using 2019b and it is working well for me.
Anis Frej
2020 年 3 月 27 日
I work with matlab R2011a
Birdman
2020 年 3 月 27 日
Anis Frej
2020 年 3 月 27 日
Isthere any other method without using the maple function because i have this problem
??? Error using ==> maple at 54
The MAPLE command is not available.
Birdman
2020 年 3 月 27 日
Is there any chance you can use a newer release of MATLAB?
Anis Frej
2020 年 3 月 27 日
i will install it
Think you
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
参考
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
