HP Forums

Full Version: [SOLVED] Issue with cZeros
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I'm developing a program to design filters using Butterworth and Chebyshev type I. To do this i defined some cas function to solve equations or denormalize things. Some of these functions are:
Code:

BP_Denorm_TF(n_filter_gain, n_filter_poles, w_central, filter_q_factor) :=
BEGIN
 cFactor(normal(n_filter_gain/ poly2symb(pcoeff(n_filter_poles), filter_q_factor * (x ^ 2 + w_central ^ 2) / (w_central * x)))); // BP transfer function
END;

BP_Denorm_Zeros(n_filter_gain, n_filter_poles, w_central, filter_q_factor) :=
BEGIN
 cZeros(BP_Denorm_TF(n_filter_gain, n_filter_poles, w_central, filter_q_factor));
END;
Use this as argument (1.002377293,{−0.707946782251-0.707946782251*i,−0.707946782251+0.707946782251*i},30781195.9239,2.44948974278)

BP_Denorm_TF works right also inside of a program.
Instead, BP_Denorm_Zeros is not working as it should inside of a program.
If i call this function directly from cas, everything works, the result is two zeros in the origin.
If i call this function inside of a program, no solutions are returned.

What's the problem?
Problem solved, when using CAS commands in program mode, you have to provide the variable to solve. I think it's because in program mode the default var is X while in CAS is x. (I'm usign x)
Reference URL's