what is wrong with matlab?

this is the block I made in matlab simulink, with function:
if true
function trans_signal = fcn(a,w,t)
trans_signal = a*cosd(w*t);
end
and display gives an answer in the negative -1.034 whereas it should be 0.8426. I tried the same in command window:
if true
>> a=1.1;
>> w=40000;
>> t=10;
>> a*cosd(w*t)
ans =
0.8426
end
Where am I wrong? It gives correct ans in command window and wrong answer in simulink.

1 件のコメント

Ameer Hamza
Ameer Hamza 2018 年 6 月 1 日
Are you sure that your simulation is running for 10 seconds? I just tried it and it is giving the correct value. Which MATLAB version are you using?

回答 (0 件)

この質問は閉じられています。

製品

質問済み:

2018 年 6 月 1 日

閉鎖済み:

2021 年 8 月 20 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by