im such a newb in matlab
Info
This question is closed. Reopen it to edit or answer.
Show older comments
hello guys im new inmatlab and i have been assigned to run the script and plot the following integral.actually this is the whole think Int _(-infinity)^(infinity) J_0( omega x) cos (omega t) omega d(omega)
"This means evaluating the integrand from plus to minus infinity. The function J_0 is the Bessel function of the first kind and exists in matlab. x and t are parameters, you can choose x = 0.1, 1 and 10, then t = 1 and 10. Matlab can't really do infinite integrals, but you can plan with omega from -20 to + 20. In total, you will need to do six integrations and show me the code you use. You will need to try to plot the integrand, and eventually -once you have a matlab script running- , plot the integral with many values of x for fixed t, then many values of t for fixed x. You will need to understand convergence, and play with integration limits of omega from -1 to 1, -5 to 5."
Until now I have created a m.file function
function y= @myfun(omeg,x,t)
y=besselj(1,omeg.*x).*cos(omeg.*t).*omeg;
and i run this like that
x=1
t=1
Q=quad(@(omeg)myfun(omeg,x,t),-20,20)
im not sure if it completely coorrect but it gives me back answer.the problem is that have no idea how to plot it.all my tries don't work unfortunately.can someone please help me???
thanks in advance
2 Comments
Jan
on 8 Jan 2013
If your tries do not work, post the corresponding code and explain what happens: Does "not work" mean, that the results differ from your expectations (if so, how), or do you get an error message.
Without seeing the failing code, it is hard to suggest an improvement.
Daniel Shub
on 8 Jan 2013
function y= @myfun(omeg,x,t) is not valid MATLAB syntax. Please edit your question to include valid code and output demonstrating what you have tried and where you are stuck and then reopen the question.
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!