Please help me to check my code
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a problem when running my code. For some reason , my plotting doesn't work, thus my graph is complete blank when I run the code. Please kindly help me to check it. This is script using loop with quad
My function:
function [ g ] = myfun( w,u )
g=1./(9.*(w.^n)-8.*w);
end
My script:
u=[4:1:10];
for iu=1:length(u)
h=quad(@(w)myfunc(w,n(iu)),6,10);
v=h(:,1)
plot(u,v)
end
Thank in advance
댓글 수: 0
답변 (1개)
Star Strider
2017년 8월 28일
Try this:
myfunc = @(w,n) 1./(9.*(w.^n)-8.*w);
u=[4:1:10];
n = some vector;
for iu=1:length(u)
v(iu) = quad(@(w)myfunc(w,n(iu)),6,10);
end
figure(1)
plot(u, v)
댓글 수: 4
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!