php
iphone
css
c
ajax
linux
android
mysql
objective-c
visual-studio
multithreading
eclipse
html5
json
perl
tsql
asp
jsp
postgresql
dom
You could either plug your values directly in the function f:
w0 = -1.9; w1 = -0.9; f = (0.5+phi)*(w0.^2 + w1.^2) + w0.*w1*cos(2*pi/M) + 2*w1*sin(2*pi/M) + 2;
or use indices on x and y:
x = -2:0.1:8; y = -10:0.1:0; [w0,w1] = meshgrid(x, y); f = (0.5+phi)*(w0.^2 + w1.^2) + w0.*w1*cos(2*pi/M) + 2*w1*sin(2*pi/M) + 2; f(find(y==-0.9), find(x==-1.9));
Both methods will return:
ans = 5.1452
Assuming f(-1.9,-0.9) = f(w0, w1)
[row0, col0] = find(w0==-1.9); [row1, col1] = find(w1==-0.9); ans = f(row1(1), col0(1));
I think the best way should be using annonymous function:
f = @(x,y) (0.5+phi)*(x.^2 + y.^2) + x.*y*cos(2*pi/M) + 2*y*sin(2*pi/M) + 2 f(-1.9,0.9)
x)