简体   繁体   中英

matlab problem in plotting a function

I have 2 functions:

f (aa) = 9 sinaa/aa + cosaa  for 0 <= aa <= 6pi.      --- >equation 1.

and f(aa) = 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 ku but here is a short answer.

You can plot f(a) and cos(ku) 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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM