how to solve error mentioned in following program?
이전 댓글 표시
This is my program
[t,Vc]=ode45('capvolt',[0 20e-3],[0])
%capvolt is the function file name
subplot(1,2,1)
plot(t,Vc,'r')
grid
title('Vc')
xlabel('time in sec')
ylabel('voltage Vc')
Vc_analy=10*(1-exp(-10*t))
subplot(1,2,2)
plot(t,Vc_analy)
grid
xlabel('time in sec')
ylabel('voltage Vc_analy')
title('Vc_analy')
%program of the function file capvolt
dVc=100-10*Vc
function dVc=capvolt(t,Vc)
And the error i am facing is : Function definitions are not permitted at the prompt or in scripts.
답변 (1개)
Azzi Abdelmalek
2013년 11월 2일
편집: Azzi Abdelmalek
2013년 11월 2일
Your function is not correct. It should be
function dVc=capvolt(t,Vc)
dVc=100-10*Vc
Save this function as capvolt.m, then you can call your function
[t,Vc]=ode45('capvolt',[0 20e-3],[0])
카테고리
도움말 센터 및 File Exchange에서 MATLAB Coder에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!