简体   繁体   English

绘制函数中的matlab问题

[英]matlab problem in plotting a function

I have 2 functions: 我有2个功能:

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? 我需要绘制将满足方程式1的aa的允许值。

I guess this is homework, and your question is not really clear about ku but here is a short answer. 我想这是家庭作业,您对ku问题并不十分清楚,但这是一个简短的答案。

You can plot f(a) and cos(ku) on the same plot, and then graphically find the solutions of the equation. 您可以在同一图上绘制f(a)cos(ku) ,然后以图形方式找到方程式的解。

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. 如果您不了解MATLAB的基本语法,则需要从头开始。 Mathworks has published a beginner's guide for MATLAB, the Getting Started Guide . Mathworks已发布了MATLAB的新手指南“入门指南” Read this, and if you have any further questions, come back to SO. 阅读此内容,如果还有其他问题,请回到SO。 You can also use the help or doc functions in MATLAB to gain more understanding about what a built-in function does. 您还可以使用MATLAB中的helpdoc函数来获得对内置函数功能的更多了解。 For example, doc sin will bring up the documentation page for the sin function. 例如, doc sin将打开sin函数的文档页面。

Also look at the EZPLOT function. 还要查看EZPLOT功能。 In addition you will also need YLIM to show the whole curve. 此外,您还需要YLIM来显示整个曲线。

To get intersections of two curves you can use Fast and Robust Curve Intersections from FileExchange. 要获取两条曲线的交点,可以使用FileExchange中的“ 快速”和“鲁棒的曲线交点” For this function you can use data you've got using Cedric's answer . 对于此功能,您可以使用通过Cedric的answer获得的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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