From help-request at octave dot org Wed Dec 29 14:02:14 2004 Subject: line 0: Can't plot with an empty x range! From: Joan Picanyol i Puig To: help at octave dot org Date: Wed, 29 Dec 2004 21:05:25 +0100 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I'm running: 511,pc,0$ uname -r; octave --version | head -1 5.3-STABLE GNU Octave, version 2.1.63 (i386-portbld-freebsd5.3). I'm getting the message in the subject and can't figure out why, since pasting the pl command that octave shows in the error in a gnuplot session works ok. The code is simple enough (the plotting in the attached channel.m): lsignal = sign(rand(1,model.n_t) - 0.5); [...] subplot(1, 1, 1); clg; hold off; axis; leg=''; model.noise = 1; model.fading = 0; model.multipath = 'none'; [lr, lalpha, lw] = channel(lsignal, 0, -3); subplot(2, 2, 1); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lw(1,1:100), 'g'); leg = [leg; 'w']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i soroll (w) SNR=-3dB'); axis([t(1), t(100), -3*median(lw(1,:)), 3*median(lw(1,:))]); etc, etc. Octave shows the gnuplot command: gnuplot> pl '/var/tmp/oct-WQnjFW' u 1:2 t "" w lines 3 ^ line 0: Can't plot with an empty x range! gnuplot> pl '/var/tmp/oct-296MpL' u 1:2 t "" w lines 3, '/var/tmp/oct-IxhAPE' u 1:2 t "" w lines 2, '/var/tmp/oct-WYuTBo' u 1:2 t "" w steps 1, '/var/tmp/oct-Fjur2Z' u 1:2 t "" w lines 2 ^ line 0: Can't plot with an empty x range! Octave only gives me this error if the global variable model.dt (which controls the spacing of 't') is smaller than 10^-7, i.e.: setting it to 0.000001 works, but 0.0000001 doesn't (I need to set it to 1/20MHz). I need the code to remain Matlab compatible, any workarounds? tks -- pica --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=oct-WQnjFW # name: /var/tmp/oct-WQnjFW # type: matrix # rows: 100 # columns: 2 24.995000025 0.0425119581983546 24.995000075 -0.303339587339322 24.995000125 1.19387152411113 24.995000175 0.155616909645759 24.995000225 0.0311651198531548 24.995000275 -1.44512015102008 24.995000325 -1.05275952435292 24.995000375 2.14813498070847 24.995000425 1.7336341087011 24.995000475 0.890767020261711 24.995000525 0.676268331198907 24.995000575 3.15972739357674 24.995000625 -0.31451302445353 24.995000675 -1.04149246043806 24.995000725 0.931840335356587 24.995000775 -0.794335709553207 24.995000825 -2.00165601700292 24.995000875 -0.327570421545534 24.995000925 -2.03130354141322 24.995000975 1.02413255608885 24.995001025 -1.59092431430855 24.995001075 0.297039282113021 24.995001125 -1.16702309490146 24.995001175 0.15058057487814 24.995001225 0.471460965785454 24.995001275 -1.0760039253142 24.995001325 0.84002499468816 24.995001375 1.09200890950489 24.995001425 -0.535118322650864 24.995001475 -0.502762023961263 24.995001525 -1.79832628797849 24.995001575 -0.0877234568244578 24.995001625 0.570027987957246 24.995001675 -1.53422783582119 24.995001725 0.633085534989343 24.995001775 0.98904682845299 24.995001825 -0.0131163412225029 24.995001875 -1.10016444207685 24.995001925 0.913425684496049 24.995001975 -1.30074119217901 24.995002025 1.73813624127262 24.995002075 -2.07492197097584 24.995002125 1.72391537444379 24.995002175 -2.8404105811816 24.995002225 0.24733746363763 24.995002275 0.507819467818978 24.995002325 1.69373419652305 24.995002375 0.307315643288162 24.995002425 1.33986661379069 24.995002475 -1.91355191774941 24.995002525 1.52921665904855 24.995002575 -0.376418452998405 24.995002625 1.47385170810246 24.995002675 -0.0398063247864194 24.995002725 -0.634466091934371 24.995002775 0.734447802896327 24.995002825 -0.220712052648993 24.995002875 -0.676259653412436 24.995002925 -0.691155437392456 24.995002975 -0.308327639663578 24.995003025 -1.57284894087071 24.995003075 0.441960490066326 24.995003125 -0.128087791726225 24.995003175 -1.16851771011059 24.995003225 -0.77561103350706 24.995003275 -1.74800037199932 24.995003325 -0.677159070626866 24.995003375 2.78040826431781 24.995003425 -0.0471765826203887 24.995003475 1.83129312274424 24.995003525 -1.89018888493331 24.995003575 1.31983250333814 24.995003625 0.0135780396733083 24.995003675 1.27608576537818 24.995003725 -0.646695312513539 24.995003775 -0.129210976347929 24.995003825 -1.28730401576077 24.995003875 -1.19056830704093 24.995003925 0.912093199486139 24.995003975 -1.18985249285787 24.995004025 -1.29016635178509 24.995004075 -1.06910252118567 24.995004125 1.62054538690028 24.995004175 -0.000966737127246819 24.995004225 1.19809835151124 24.995004275 1.38049284447044 24.995004325 0.919075685464137 24.995004375 -2.48574662230521 24.995004425 -1.49767785533453 24.995004475 -0.83326322404175 24.995004525 0.102725911353067 24.995004575 0.304895413560584 24.995004625 -0.686908777864014 24.995004675 -2.3732604485344 24.995004725 1.92351049167608 24.995004775 1.52087160524333 24.995004825 0.612630499381191 24.995004875 1.44018843763552 24.995004925 0.401355358303439 24.995004975 -2.29824096623414 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="init_model.m" Content-Transfer-Encoding: 8bit 1; clear all debug_on_error=1; debug_on_warning=0; silent_functions=1; global model model.c = 3*10^8; model.f_c = 2*10^9; model.f_s = 2*model.f_c; model.d = 50; model.r = 2500; model.lambda = model.c/model.f_c; model.delta_theta = pi/180; %resolució angular (radiants) model.v = 100; %m/s; 100km/h=27.7m/s, 100m/s=360km/h model.Q = 3; model.dt = 50*10^-9; model.snapshots = 1; model.beta = 0.9; model.noise = 1; model.fading = 1; model.SNR = 0; model.multipath = 'none'; global options options.save = 0; options.plot = 1; options.max_t = 100000; setup_model; --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="setup_model.m" if (model.v>0) model.n_t = floor(2 * model.r / model.v / model.dt); if (model.n_t > options.max_t) if (model.n_t < options.max_t / 2) t = model.dt:model.dt:options.max_t * model.dt; model.delta_theta = pi / 180 / 2; %approx. else middle = model.dt * model.n_t / 2; beg = middle - options.max_t * model.dt; t = beg + model.dt:model.dt:middle; model.delta_theta = atan((model.r - model.v * beg)) / 180; end model.n_t = options.max_t; else t = 0:model.dt:2 * model.r / model.v - model.dt; end else t = 0:40 / model.n_t:40; end --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="verify_channel.m" function [lsignal, lr, lw, lalpha] = verify_channel(pmultipath, pnoise, pfading) global model; global options; setup_model; lsignal = sign(rand(1,model.n_t) - 0.5); if (pnoise == 1) subplot(1, 1, 1); clg; hold off; axis; leg=''; model.noise = 1; model.fading = 0; model.multipath = 'none'; [lr, lalpha, lw] = channel(lsignal, 0, -3); subplot(2, 2, 1); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lw(1,1:100), 'g'); leg = [leg; 'w']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i soroll (w) SNR=-3dB'); axis([t(1), t(100), -3*median(lw(1,:)), 3*median(lw(1,:))]); [lr, lalpha, lw] = channel(lsignal, 0, 0); subplot(2, 2, 2); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lw(1,1:100), 'g'); leg = [leg; 'w']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i soroll (w) SNR=0dB'); axis([t(1), t(100), -3*median(lw(1,:)), 3*median(lw(1,:))]); [lr, lalpha, lw] = channel(lsignal, 0, 3); subplot(2, 2, 3); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lw(1,1:100), 'g'); leg = [leg; 'w']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i soroll (w) SNR=3dB'); axis([t(1), t(100), -3*median(lr(1,:)), 3*median(lr(1,:))]); [lr, lalpha, lw] = channel(lsignal, 0, 300); subplot(2, 2, 4); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lw(1,1:100), 'g'); leg = [leg; 'w']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i soroll (w) SNR=6dB'); axis([t(1), t(100), -3*median(lr(1,:)), 3*median(lr(1,:))]); end if (pfading == 1) subplot(1, 1, 1); clg; hold off; axis; leg=''; model.noise = 0; model.fading = 1; model.multipath = 'none'; [lr, lalpha, lw] = channel(lsignal, 200, 300); subplot(2, 2, 1); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lalpha(1,1:100), 'g'); leg = [leg; 'a']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i fading (a) f_d=200Hz'); axis([t(1), t(100), 1.15*min(lr(1,:)), 1.15*max(lr(1,:))]); [lr, lalpha, lw] = channel(lsignal, 700, 300); subplot(2, 2, 2); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lalpha(1,1:100), 'g'); leg = [leg; 'a']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i fading (a) f_d=700Hz'); axis([t(1), t(100), 1.15*min(lr(1,:)), 1.15*max(lr(1,:))]); [lr, lalpha, lw] = channel(lsignal, 1200, 300); subplot(2, 2, 3); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lalpha(1,1:100), 'g'); leg = [leg; 'a']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i fading (a) f_d=1200Hz'); axis([t(1), t(100), 1.15*min(lr(1,:)), 1.15*max(lr(1,:))]); [lr, lalpha, lw] = channel(lsignal, 1700, 300); subplot(2, 2, 4); clg; hold on; plot(t(1:100), lr(1,1:100), 'b'); leg = [leg; 'r']; plot(t(1:100), lalpha(1,1:100), 'g'); leg = [leg; 'a']; plot(t(1:100), lsignal(1,1:100), 'rL'); leg = [leg; 's']; title('Senyal (r) i fading (a) f_d=1700Hz'); axis([t(1), t(100), 1.15*min(lr(1,:)), 1.15*max(lr(1,:))]); end end --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="channel.m" function [ltmps, alpha, w] = channel (ps, pf_d, pSNR) global model; lfd_s=5000; ltaps = 1; lpow = 1; llags = 1; if (strcmp(model.multipath, 'none') ~= 1) ltaps = gen_multipath(model.multipath); llags = find (ltaps ~= 0); lpow = ltaps (llags); end lnpaths = size(llags, 2); alpha = ones(lnpaths, model.n_t); w = zeros(lnpaths, model.n_t); if (model.fading == 1) alpha = gen_rayleigh(max(pf_d), lfd_s, model.n_t, lnpaths); P_alpha = sum(alpha.^2, 2) / model.n_t, alpha = alpha ./ repmat(sqrt(P_alpha), [1 model.n_t]); end if (model.noise == 1) w = wgn(lnpaths, model.n_t, 1, 'complex'); end N_f = 10^(-pSNR / 20) w = w * N_f; ltmps = repmat(ps, [lnpaths 1]) .* alpha + w; ltmp = zeros(lnpaths, model.n_t + size(ltaps, 2)); for lp = 1:lnpaths ltmp(lp,llags(lp):model.n_t + llags(lp) - 1) = ltmps(lp,:) * lpow(lp); end ltmps = sum(ltmp(:,1:model.n_t), 1); end --7JfCtLOvnd9MIVvH-- ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------