How to change this function fun = @(x)x(1)*exp(-norm(x)^2) to x^2+y^2?

20 views (last 30 days)
Hi
I dont know how to change fun = @(x)x(1)*exp(-norm(x)^2) to function x^2+y^2??
Thanks for answers

Answers (1)

Alex Mcaulley
Alex Mcaulley on 28 May 2019
fun = @(x) (x(1)^2 + x(2)^2) %x(1) is x and x(2) is y
%or
fun = @(x,y) (x^2 + y^2)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!