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!