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에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!