I would like to know how to plot functions with parameters in matlab. For example, the electric potential is described as V(d)=1/(4pi*eps0*d^2) I would like to plot the electric potential as a symbolic function but to choose which variable to plot as the independent variable. For example, V(d) or V(eps)... How to tell matlab that d is the variable and eps id the parameter? Thanks very much
I would go this way:
syms d;
syms eps;
V = 1./(4.*pi.*eps.*d.^2);
You may think of using ezplot
capabilities; for instance, you could call
ezplot(subs(V,eps,0.1))
ezplot(subs(V,d,0.1))
In the previous two lines you are saying:
1) plot V
depending on d
and eps = 0.1
;
2) plot V
depending on eps
and d = 0.1
.
I hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.