Unrecognized function or variable

13 ビュー (過去 30 日間)
Joshua Primeaux
Joshua Primeaux 2021 年 2 月 8 日
回答済み: muhammad satriawan 2021 年 7 月 8 日
syms t
x(t) = piecewise (t>=0, sin(3*t), t>=2*pi, sin(3*t)^2, t>3*pi,0);
t1 =0:0.1:3*pi;
x=subs(x,t,t1);
plot(t1,x)
xlabel('Time')
ylabel('x(t)')
disp('Energy of x(t)')
Energy of x(t)
I1 = int(sin(3*t)^2);
I2 = int(sin(3*t)^4);
E = I1(2*pi)-I1(0)+I2(2*pi)-I2(3*pi)
Energy of x(t)
Unrecognized function or variable 'Energy'.
This is my code I'm not sure why it is saying unrecognized function any help would be appreciated thank you.

回答 (3 件)

Steven Lord
Steven Lord 2021 年 2 月 8 日
I suspect you copied and pasted what had been typed and/or displayed in the Command Window (including the text that your disp call displayed, namely "Energy of x(t)") into a file in the Editor/Debugger and tried to run it. You'll need to delete or comment out the displayed text in the file in the Editor/Debugger..
  1 件のコメント
Joshua Primeaux
Joshua Primeaux 2021 年 2 月 8 日
ok I fixed that now I'm getting
syms t
x(t) = piecewise (t>=0, sin(3*t), t>=2*pi, sin(3*t)^2, t>3*pi,0);
t1 =0:0.1:3*pi;
x=subs(x,t,t1);
plot(t1,x)
xlabel('Time')
ylabel('x(t)')
disp('Energy of x(t)')
I1 = int(sin(3*t)^2);
I2 = int(sin(3*t)^4);
E = I1(2*pi)-I1(0)+I2(2*pi)-I2(3*pi)
Index exceeds the number of array elements (1).
Error in sym/subsref (line 902)
R_tilde = builtin('subsref',L_tilde,Idx);

サインインしてコメントする。


madhan ravi
madhan ravi 2021 年 2 月 8 日
Following Steven’s answer would clear that error but you will have a following error, so change that part of your code to the following:
%Energy of x(t)
I1(t) = int(sin(3*t)^2);
I2(t) = int(sin(3*t)^4);
E = I1(2*pi)-I1(0)+I2(2*pi)-I2(3*pi)
%Energy of x(t)
  1 件のコメント
Joshua Primeaux
Joshua Primeaux 2021 年 2 月 8 日
Thank you that worked

サインインしてコメントする。


muhammad satriawan
muhammad satriawan 2021 年 7 月 8 日
p = [ 0.1987 0.2722 0.0153 0.4451 0.466 0.8462 0.2026 0.8381 0.6813 0.8318 0.7095 0.3046 0.1934 0.3028 ;
0.6038 0.1988 0.7468 0.9318 0.4186 0.5252 0.6721 0.0196 0.3795 0.5028 0.4289 0.1897 0.6822 0.5417 ];
net = newc ([0 1 ; 0 1],6);
net.IW {1,1};
net.b {1};
net = train (net,p);
%Mencari pengelompokan vektor
b = sim(net,p);
ac = vec2ind(b);
net = init(net);
net.trainParam.epochs = 500 ; %pelatihan kohonen
net = train(net,p);
Unrecognized function or variable 'newc'.
Error in JKohonen (line 5)
net = newc ([0 1 ; 0 1],6);

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by