Verifying equation [43] for MATLAB implementation

  • Context: MATLAB 
  • Thread starter Thread starter strokebow
  • Start date Start date
  • Tags Tags
    Mistake
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 3K views
strokebow
Messages
122
Reaction score
0
Hi guys,

Please can someone look at this working (see attached).

The equation in question is [43]. It is highlighted with a red border.

The numerical answers in the pdf are correct and have been verified against published material.

That being said, I believe there must be a problem with equation [43] as I am not getting the same answers. I don't know how the algebra was simplified etc. to get to [43].

I have inputted [43] as it is in MATLAB and get incorrect results:
Code:
function [y] = inf_res_hex_odd(x,y,m,n)
y = ((1)/(4*(pi^2)))*((3-2*cos(y).*cos(m*x+n*y)-cos((m-1)*x+n*y))./(4-cos(y).*(cos(y)+cos(x))));
end

Example:
>> real((quad2d(@(x,y)inf_res_hex_odd(x,y,1,0),-pi,pi,-pi,pi)))

ans =

0.5422

There are 2 possibilities:
1) I made a mistake in my MATLAB function, or,
2) There is a mistake/typo in [43]

If anyone can offer any help with this I would be really appreciative.

Thanks
 

Attachments

Physics news on Phys.org
No takers?

I've been staring at this bad boy for some time now... can't manage to find the problem.

any help/suggestions would be much appreciated... :-)
 
The material is too cryptic to respond to.
 
Don't expect people to look up MatLab syntax and command(s).

Type the equation in Latex so people can see it. What variables do you put in for x,y,m, and n? (I (and maybe others) don't know MatLab syntax/command(s) so don't know what the (x,y,1,0... -pi,pi,-pi,pi) stuff means, although it looks like ranges of evaluation)

In addition, your formatting was sloppy/lazy: there are more ))) on the one side of 1/4pi^2 than there are on the other. How is someone supposed to understand what you actually want?

Something like:
[tex]f(x,y,m,n)=\frac<br /> {\frac {1} {4 \times \pi^2} \times \left ( 3-2 \times \cos{y} \right)<br /> \times \cos \left( m \times x + n \times y \right ) - \cos \left ( \left (m-1 \right ) \times x + n \times y \right)}<br /> {\left ( 4-\cos{y} \right ) \times \left (\cos{y} + \cos{x} \right ) }[/tex]
 
Last edited: