How to get rid of unwanted stuff (noise) on x-axis of my neutron star flux curve??
Show older comments

Hi,
I am currently modeling flux/intensity coming from a milisecond pulsar, taking into account different GR and SR effects (Light bending, Doppler, Time Delay...). The code works fine, but I keep getting this annoying stuff on my x-axis when plotting the results and I simply can't work out where it's coming from...?
Some detail about the code: I've created a function PointFlux that can set the colatitude of the spot, the axis of rotation, the mass of the neutron star, its rotational frequency, Schwarzschild radius as well as turn on certain flags for Light Bending, Doppler, and an Antipodal Spot,
Flux = PointFlux(theta,i,phi,Mn,h,rs,R,ApodalFlag,LBFlag,DFlag).
The plot below shows those two:
dOmega(k)=PointFlux(pi/3,pi/8,phi(k),Mn,h,rs,R,0,0,0); % (no Light bending, green dot-dashed curve)
dOmegaLB(k)=PointFlux(pi/3,pi/8,phi(k),Mn,h,rs,R,0,1,0); % (Light bending, blue dot-dashed curve)
But why is there a blue dot-dashed line on my x-axis??
The PointFlux code is rather long but if it would provide insight into where the noise is coming from I can provide it.
I'd be super grateful for advice since I have to include those plots in my paper which is due in a week!!
Thank you! Cheryne
3 Comments
dpb
on 21 Dec 2015
Well, we can't see what you actually plot ted; clearly there's a zero-valued vector also being plotted along with the two sinusoidal traces. Where it comes from specifically is indeterminate from the data supplied.
At least show the plot call(s) used.
I'd note it looks like you're not using the facilities of Matlab to compute values in a vectorized fashion but by calling a function on individual values point-by-point. It'd likely benefit much in moving the looping constructs (if needed) into the function PointFlux to be able to handle a vector phi internally.
What is
size(dOmega(k)) % and friend corollary, just for grins?
Kirby Fears
on 21 Dec 2015
Cheryne,
Are you creating a plot inside of PointFlux?
Set a breakpoint wherever you are actually calling plot(). Then run your code again - when it stops at the breakpoint, inspect the vectors you are plotting. It seems like you are plotting a column of 0's. You should be able to track back through your code to see where the column of 0's is coming from.
Image Analyst
on 21 Dec 2015
Are you calling plot() or plotyy() with only 3 arrays instead of 4, like plot(y1,y2,y3) instead of plot(x1,y1,x2,y2) which passes in 4 arrays?
Answers (0)
Categories
Find more on Two y-axis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!