Warning: Error updating FunctionLine. The following error was reported evaluating the function in FunctionLine update:Array indices must be positive integers or logical value
14 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Pratyush Swain
le 21 Mai 2024
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.
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!