簡體   English   中英

階躍函數/重邊函數MATLAB錯誤

[英]Step functions/Heaviside Functions MATLAB error

所以我試圖在MATLAB中使用heaviside和ezplot函數繪制f(t)這是一個分段函數。 現在我對MATLAB一點都不熟悉。 如果有人知道為什么我會收到此錯誤,它將很有幫助。

f = '12 +(-2t + 8)*糖苷(t-2)+(2t-12)*糖苷(t-6)'

f = 12 +(-2t + 8)*糖苷(t-2)+(2t-12)*糖苷(t-6)

ezplot(F)

使用inlineeval的錯誤(第15行)內聯表達式中的錯誤==> 12 +(-2t + 8)。* heaviside(t-2)+(2t-12)。* heaviside(t-6)錯誤:MATLAB表達式異常。

內聯/插入錯誤(第34行)INLINE_OUT_ = inlineeval(INLINE_INPUTS_,INLINE_OBJ_.inputExpr,INLINE_OBJ_.expr);

ezplotfeval(第52行)中的錯誤z = feval(f,x(1));

ezplot> ezplot1中的錯誤(第469行)[y,f,loopflag] = ezplotfeval(f,x);

ezplot中的錯誤(第145行)[hp,cax] = ezplot1(cax,f {1},vars,labels,args {:});

您需要告訴Matlab顯式乘法,使用2 * t而不是2t。

syms t real
f = 12+(-2*t+8)*heaviside(t-2)+(2*t-12)*heaviside(t-6)
ezplot(f,[0 10])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM