Borrar filtros
Borrar filtros

Warning: Error updating FunctionLine. The following error was reported evaluating the function in FunctionLine update:Array indices must be positive integers or logical value

3 visualizaciones (últimos 30 días)
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

Respuestas (1)

Pratyush Swain
Pratyush Swain el 21 de Mayo de 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.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by