user2432070
user2432070

Reputation: 21

Plotting symbolic functions Matlab parameters

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

Upvotes: 1

Views: 5681

Answers (1)

fpe
fpe

Reputation: 2750

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.

Upvotes: 2

Related Questions