Warning: Error updating FunctionLine. The following error was reported evaluating the function in FunctionLine update:Array indices must be positive integers or logical value
2 ビュー (過去 30 日間)
古いコメントを表示
A=10^(-4);
l= 250*10^(-6);
g=0.1517;
e=0.132205;
d=0.142;
K= 2.34*10^(-12);
Yr = @ (w) w*A*e*{d(1-K)+gK}/[l{(1-K)^2 +(gK)^2} ];
fplot(Yr,[10,100],"r")
xlabel('Frequency')
ylabel('Conductance')
grid on
0 件のコメント
回答 (1 件)
Pratyush Swain
2024 年 5 月 21 日
Hi Utkarsh,
The error you're encountering in your MATLAB code is due to the misuse of curly braces {} instead of parentheses () for grouping expressions. Curly braces are used in MATLAB for cell arrays, which is why you're seeing an error about array indices needing to be positive integers or logical values.
The code can be modified accordingly as follows:
A = 10^(-4);
l = 250*10^(-6);
g = 0.1517;
e = 0.132205;
d = 0.142;
K = 2.34*10^(-12);
% Corrected use of parentheses
Yr = @(w) w*A*e*(d*(1-K)+g*K) / (l*((1-K)^2 +(g*K)^2));
fplot(Yr, [10,100], "r")
xlabel('Frequency')
ylabel('Conductance')
grid on
I hope this is the output you had in mind.
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!