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,:);
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 ;
5 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838484
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838484
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838646
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838646
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838676
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838676
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838677
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838677
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838683
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/522010-if-i-has-supply-0-2x-20-and-p-randdata-1-is-there-a-way-to-substitute-p-in-for-x#comment_838683
Sign in to comment.