If i has supply=0.2x + 20 and p=RandData(1,:) is there a way to substitute p in for x?
Mostrar comentarios más antiguos
If i has supply=0.2x + 20 and p=RandData(1,:) is there a way to substitute p in for x?
5 comentarios
Elliott Cameron
el 30 de Abr. de 2020
darova
el 30 de Abr. de 2020
what about subs?
syms s p
supply = 0.2*x + 20;
new_supply = subs(supply,x,p);
Elliott Cameron
el 30 de Abr. de 2020
Elliott Cameron
el 30 de Abr. de 2020
darova
el 30 de Abr. de 2020
You can clear sym variables after
clear x p
Respuestas (1)
Samatha Aleti
el 3 de Mayo de 2020
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 ;
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!