matlab problem in plotting a function
I have 2 functions:
f (aa) = 9 sinaa/aa + cosaa for 0 <= aa <= 6pi. --- >equation 1.
and f(开发者_如何学Goaa) = cosku
I need to plot the allowed values of aa which will satisfy the equation 1. How do i do this i matlab?
I guess this is homework, and your question is not really clear about k u
but here is a short answer.
You can plot f(a)
and cos(k u)
on the same plot, and then graphically find the solutions of the equation.
Here is a very basic example of code:
a=0:0.01:6*pi;
f = 9*sin(a)./a+cos(a);
plot(a,f)
hold on
u = 0:0.01:6*pi;
f2 = cos(u);
plot(u,f2)
If you don't know basic MATLAB syntax, you need to start at the beginning. Mathworks has published a beginner's guide for MATLAB, the Getting Started Guide. Read this, and if you have any further questions, come back to SO. You can also use the help
or doc
functions in MATLAB to gain more understanding about what a built-in function does. For example, doc sin
will bring up the documentation page for the sin
function.
Also look at the EZPLOT function. In addition you will also need YLIM to show the whole curve.
To get intersections of two curves you can use Fast and Robust Curve Intersections from FileExchange. For this function you can use data you've got using Cedric's answer.
精彩评论