If i has supply=0.2x + 20 and p=RandData(1,:) is there a way to substitute p in for x?

1 回表示 (過去 30 日間)
Elliott Cameron
Elliott Cameron 2020 年 4 月 30 日
回答済み: Samatha Aleti 2020 年 5 月 3 日
If i has supply=0.2x + 20 and p=RandData(1,:) is there a way to substitute p in for x?
  5 件のコメント
Elliott Cameron
Elliott Cameron 2020 年 4 月 30 日
or to then remove the syms after?
darova
darova 2020 年 4 月 30 日
You can clear sym variables after
clear x p

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

回答 (1 件)

Samatha Aleti
Samatha Aleti 2020 年 5 月 3 日
Hi,
If you have to define “supply” in terms of “x” initially then you can substitute “p” in place of “x” by using syms” as follows:
syms x
supply=0.2*x + 20 ;
p=RandData(1,:); % As per your code
out = subs(supply, p);
clear x;
Otherwise you can define “p" and then define "supply" in terms of "p" as follows:
p=RandData(1,:);
supply=0.2*p + 20 ;

カテゴリ

Help Center および File ExchangeFormula Manipulation and Simplification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by