Re: [Scilab-users] [Scilab-Dev] algebra conventions with integer types to be discussed
Hello Philippe, Great to hear from you, Le 18/09/2018 à 19:26, philippe a écrit : Le 17/09/2018 à 19:03, Stéphane Mottelet a écrit : Do I have to conclude that the implementation is currently so incoherent that *nobody* uses integer types in Scilab (other than Scilab code itself) ? it's a new feature, I would have like to use it before ... I've build my own solution and now I just need time replace it with int64. For mixed int/double expression I expect to get the best floating point approximation as a result. and for int/int ? S. Best regards, Philippe ___ users mailing list users@lists.scilab.org https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] [Scilab-Dev] algebra conventions with integer types to be discussed
Le 17/09/2018 à 19:03, Stéphane Mottelet a écrit : > > Do I have to conclude that the implementation is currently so incoherent > that *nobody* uses integer types in Scilab (other than Scilab code > itself) ? it's a new feature, I would have like to use it before ... I've build my own solution and now I just need time replace it with int64. For mixed int/double expression I expect to get the best floating point approximation as a result. Best regards, Philippe ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Frequency response
Hi Tan, et al. Thank you for the complete response to my initial request. This is very helpful for me to understand ... but if this is indeed the equivalent of the matlab script, I wonder about if the help I found in the matlab forum is helpful or not. The reason I'm still wondering is because the matlab forum question is exactly like mine - I wish to find the fft of a loudspeaker impulse response and I expect a loudspeaker frequency response with roll-off at low frequencies, but now that I see the result of the below script with random data for the impulse response ... I see that the generated output is a "filter" - which is not at all what I expected and I think the similar response in the matlab forum was also not helpful (I do not have access to matlab / cannot test and or verify). Sorry for this. The entire concept may not be useful in my case, but Scilab supports advanced FFT routines (FFTW) and it should be possible to do what I need. Rafael is right that the previously attached stepresponse script explains in detail my situation. If I take the "H" vector (the impulse response) in the script and apply a basic fft(H), it looks like this: Added script code: Resp = fft(H); [db,phi] = dbphi(Resp); // convert frequency response into magnitude and phase f_max = 1/tau_step; // Hz f = f_max * (0:length(H)-1)/length(H); //associated frequency vector scf(); plot(f'(2:nt/2),db(2:nt/2)); // Transpose X to prevent WARNING re = gca(); re.log_flags = "lnn"; xgrid(color("grey70")); xlabel("Frequency (Hz)"); ylabel("Magnitude (dB)"); RESULT : This is not exactly what I had in mind, the "shape" of the curve isn't right, but then again - there are some inner-workings I don't know about (like, is the dbphi function doing what I think it does?). Maybe I cannot use dbphi(), or maybe I just have an error somewhere in the calculation of the impulse response. I expected a level of approx. 86 dB with a roll-off towards the lower frequencies. Here's the expected response (from simulation based on the input response function, i.e. not based on impulse response and not by fft): Best regards, Claus On 18.09.2018 04:25, Tan Chin Luh wrote: On 18/9/2018 5:15 AM, Rafael Guerra wrote: Chin Luh: good to know but how does that solve Claus Futtrup specific problem? ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users just notice that the answer similar as the one Tim provided, just a bit confused on Claus' comment on the "random" data: On 17/9/2018 1:13 AM, Claus Futtrup wrote: What I like about the Matlab example is that random data is generated to represent the impulse response, so this represents "any data" ... I need that. If Scilab cannot do it, it's OK. Do you refer this "random" data to the example provided? h = rand(1,64); % impulse response <-- This? fs = 1000; Nfft = 128; [H,F] = freqz(h,1,Nfft,fs); plot(F,H); grid on; If so, the equivalent scilab code would be as below: h = rand(1,64); fs = 1000; b = poly(h($:-1:1),"z","coeff"); a = %z^(length(h)-1); Gz = syslin('d',b,a); Gz.dt = 1/fs; [F,H]=repfreq(Gz,0,500,0.01); plot(F,H); Do note that I replace the last part of semilogx plot and replace with plot for more simple codes. -- Tan Chin Luh Trity Technologies Sdn Bhd Tel : +603 80637737 HP : +6013 3691728 ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
[Scilab-users] tf2ss error in Scilab, comparing Scilab and Matlab
Dears, We here simulate on xcos and matlab/simulink platform, an oscillator to get the behavior of a hydraulic water harmmer in a penstock, following a transmittance of 2 order : b*s/(1+a*s^2). Our main reference is based on a canonic method using only two integrators and we also do some tests with a state space representation, with xcos and simulink The tfss2 function to go from transmittance state-space representation, in xcos, gives results : XCOS STATE-SPACE MATRIX A =[ 0. - 1.3782485 ; 1.0. ] B=[ 5.2800843 ; 0.] C=[- 5.28008430. ] D=[ 0. ] X0[ 0. ; 0.] MATLAB STATE-SPACE MATRIX A =[ 0. - 0.7256 ; 1.0.] B =[ 1. ; 0. ] C=[ - 20.22810. ] D = [0. ] X0 = [ 0. ; 0.] TRANSFER FUNCTIONS TRANSMITTANCE H - 20.228058s -- 1 + 0.7255586s ^2 TRANSMITTANCE MATLAB SYSMATLAB - 27.877756s -- 1 + 1.3781698s ^2 Entering in a numerical scop XY, X=canonic method, Y=State-Space method, we cleary see a correct behavior X=Y with Matlab/Simulink coefficients, and a a very strong dispersion with Scilab/Xcos computing parameters. On another way, and because we need a stable state at t=0 (no oscillation), apparently, only the canonic method runs in all modes (sequence=1 ou 2 in the script). The initial vector X0 is only able to controll the first point, but not the stability in this case, so it works only with a zero initial condition. Program Xcos/Scilab, ou Matlab/Simulink, schemes, results are available in buggzilla n°15771 Tests have been done with Scilab 5.5.2 under windows W10. To read you. Sincerely Pierre Perrichon ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] Frequency response
“just notice that the answer similar as the one Tim provided, just a bit confused on Claus' comment on the "random" data” Claus problem is defined in the script: “stepresponse - 2018-09-16.sce” that was forwarded earlier ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users