Dirac function and matlabFunction
7 ビュー (過去 30 日間)
古いコメントを表示
hello!
I'm having problems evaluating a matlab function that has dirac within. I have the following symbolic function: mf = v^2*dirac(x + 0.5) + 3*v^2*dirac(x + 0.5, 1)
I then created a matlab function by doing this: ht = matlabFunction(mf)
ht = @(v,x)(v.^2.*dirac(x + 0.5) + 3.*.v.^2.*dirac(x + 0.5, 1))
Everything works well. But when I then try to evaluate the function by doing this:
ht(2, 7)
I get an error. It says "Error using dirac. Too many input arguments." How do I evaluate that function correctly?
thanks in advance!
0 件のコメント
回答 (4 件)
Carlos
2014 年 4 月 3 日
編集済み: Carlos
2014 年 4 月 3 日
The problem is this line of the code dirac(x + 0.5, 1), dirac only allows one argument. Why do you include the second parameter 1? What do you want to represent? Just a dirac function centered in -0.5? then just write dirac(x + 0.5) as in the previous command
0 件のコメント
Azzi Abdelmalek
2014 年 4 月 3 日
In your expression what is dirac(x+0.5,1)? it should be dirac(x+0.5)
ht = @(v,x)(v.^2.*dirac(x + 0.5) + 3*v.^2.*dirac(x + 0.5))
ht(2,7)
0 件のコメント
Walter Roberson
2014 年 4 月 4 日
Please show the z formula for which mf is the derivative.
It appears to me that your z most likely contains dirac and not heaviside and that dirac(x + 0.5,1) is an attempt to represent the first derivative of the dirac function.
Which MATLAB version are you using? Are you possibly using Maple as your symbolic engine instead of MuPAD ?
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!