function simps()
A=[0,0];
B=[0,0];
set_param('circuit/LINE2','Capacitance',num2str(C(1)))
sim('circuit')
B=[Real,Reactive];
A=[A;B];
end
C
is a matrix. It contains 10 variables. Like 1,10,50,100 random.It is in uF.
circuit
is name of file
Real Reactive
are the to workspace
name.
LINE2
is the name of the RLC branch. RLC branch contains only capacitance.
I am getting error
"Undefined function or method 'C' for input arguments of type 'double'. "
I have searched stackoverflow, everybody talks about directory problem. But all my files are inside RUN directory.
I did
>> which C
It returned
C is a variable.
So I think the C is in directory path of matlab. So where is the error?
You've to do either of following
a) pass
C
as argument to functionsimps()
OR
b) evaluate
C
from workspaceC = evalin( 'base', 'C' );
inside the function before its use.
Also, use of
eval
andevalin
is generally discouraged as it makes your code harder to follow and re-use.Tip :
You may want to combine both like following