HP Forums
[SOLVED] Issue with cZeros - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: [SOLVED] Issue with cZeros (/thread-7721.html)



[SOLVED] Issue with cZeros - tiamattia - 02-05-2017 11:06 AM

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?


RE: Issue with cZeros - tiamattia - 02-05-2017 11:31 AM

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)