|
From: | RT |
Subject: | Bug / compatibility any way to work around? |
Date: | Tue, 4 Nov 2014 09:26:39 -0500 |
Bug / compatibility problem . I'm using octave 3.8.1 on ubuntu 14.04 64 bit the code below works in matlab but I get an error when run with octave does anyone know a workaround?
The error that comes back is
error: octave_base_value::array_value(): wrong type argument 'complex matrix'
error: called from:
which is an error in the set(handle, 'YData', f(x, b)) % set new y-data in plot handle line
Code below:
% // Parameter and x-range
m=3.73;
a=480;
r=1;
fs=44100;
x=linspace(0,2*pi,fs)';
% // function to compute y for given x and parameter b
f = @(x, b) m^3*cos(sqrt(a*r*x)).^(0.77)/r + m^3*cos(sqrt(b*r*x)).^(0.77)/r-20;
% // first plot out of loop (to get plot handle)
figure;
b = 300;
y = f(x, b);
handle = plot(x, y);
xlabel('x') % // only set once
ylabel('y=f(x,b)') % // only set once
title(['b = ' num2str(b)]);
pause(0.1);
% // animate for b = 301 to 86
for b = 301:486 %// Change
set(handle, 'YData', f(x, b)) % set new y-data in plot handle
pause(0.1); %// update plot
title(['b = ' num2str(b)]); %// update title
end
[Prev in Thread] | Current Thread | [Next in Thread] |