How do I plot for orthogonality?
显示 更早的评论
Hello! I am having problem while plotting for an orthogonality problem. The function I need to integrate is: cos(2*pi*w*n*t) * cos (2*pi*w*n*t). Here w= 20, n=1,2,3,4,5,6, and m=2. Integration limit is from t=0 to t=T. According to orthogonality, the answer to the integral will be 1/2w. I have to use time period of 50 points.
syms t
m=2;
w=20;
for n= 1:1:5
y1=int( cos(2.*pi.*n.*w.*t).* cos(2.*pi.*m.*w.*t), t)
fplot (y1, [0 50])
hold on;
end
Is this the way to do it?
2 个评论
Torsten
2022-9-6
I don't understand what you are trying to plot and what you expect to see.
John D'Errico
2022-9-6
编辑:John D'Errico
2022-9-6
Why would you possibly expect to get a sine function? The result of that integration would be a constant, not a function of t at all. Anyway, if you were expected to use a NUMERICAL integration, then int is the wrong tool to use! int is a SYMBOLIC integration.
Tools for numerical integration on a fixed set of points are things like trapezoidal rule, or Simpson's rule. While the function integral in MATLAB is also a variation of numerical integration, it does not operate on a fixed set of points, so it would NOT be acceptable for your assignment.
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!