Plotting a potential function in MATLAB


by maxtor101
Tags: function, matlab, plotting, potential
maxtor101
maxtor101 is offline
#1
Nov14-12, 08:08 AM
P: 24
Hi all,

I would like to be able to plot this function in MATLAB


[itex] \mathcal{V} (\phi_{1}, \phi_{2}) = m^2(\phi_{1}^2 + \phi_{2}^2) + \lambda( \phi_{1}^2 + \phi_{2}^2)^2[/itex]


Where [itex] \phi_{1,2} , m^2 , \lambda \in \mathbb{R} [/itex] and [itex] \lambda > 0 [/itex]


I am aware that the cases [itex] m^2 > 0 [/itex] and [itex] m^2 < 0 [/itex] yield two different plots.

I encountered this while doing some reading on QFT, this potential was used in a Lagrangian density while trying to demonstrate spontaneous U(1) symmetry breaking.

I would really like to be able to plot this in MATLAB but unfortunately I have minimal previous experience with it.

Would anybody here be able to help me please?

Thanks
Max
Phys.Org News Partner Mathematics news on Phys.org
Researchers help Boston Marathon organizers plan for 2014 race
'Math detective' analyzes odds for suspicious lottery wins
Pseudo-mathematics and financial charlatanism
Yuu Suzumi
Yuu Suzumi is offline
#2
Nov14-12, 11:10 AM
Yuu Suzumi's Avatar
P: 16
Hello Maxtor,

I believe the surf() function in matlab to be suited for your purposes.

After defining [itex] \phi_1, \phi_2, V [/itex] in MATLAB you would use it in this way:
surf(phi_1, phi_2, V). Information and examples are available here:

http://www.mathworks.de/de/help/matlab/ref/surf.html

All the best,
Yuu
maxtor101
maxtor101 is offline
#3
Nov14-12, 02:18 PM
P: 24
Thank you for your reply!

phi1 = [-20:0.5:20];
phi2 = [-20:0.5:20];
lam = 1;
m = 1;

V = (m^2)*(phi1.^2 + phi2^2) + lam*(phi1.^2 + phi2.^2).^2 ;


surf(phi1, phi2, V)



I tried this but I get the following error:

Error using ^
Inputs must be a scalar and a square matrix.
To compute elementwise POWER, use POWER (.^) instead.

Error in p1a (line 6)
V = (m^2)*(phi1.^2 + phi2^2) + lam*(phi1.^2 + phi2.^2).^2 ;

maxtor101
maxtor101 is offline
#4
Nov14-12, 02:23 PM
P: 24

Plotting a potential function in MATLAB


Apologies, I got it working


[phi1, phi2] = meshgrid(-20:0.5:20);

lam = 1;
m = 1;

V = (m^2)*(phi1.^2 + phi2^2) + lam*(phi1.^2 + phi2.^2).^2 ;


surf(phi1, phi2, V)



thanks for your help!
Yuu Suzumi
Yuu Suzumi is offline
#5
Nov15-12, 04:55 AM
Yuu Suzumi's Avatar
P: 16
You are very welcome


Register to reply

Related Discussions
Matlab - plotting a function Engineering, Comp Sci, & Technology Homework 1
MATLAB function plotting Engineering, Comp Sci, & Technology Homework 2
Matlab Plotting of QM double-potential-barrier Math & Science Software 2
plotting max function in matlab Math & Science Software 0
Plotting a function - MATLAB Math & Science Software 2