piecewise chaotic map

here is my main piecewise funcation. I did the code just like the logstic map
function code()
%Initialization Starts
clc
clear all
close all
%lots of constants here
%define rimax, Ri, P1, P2, n1 and n2
f = 0:0.01:20; % f is in the P function
r1 = 0.384;
r1 = R(r1);
for i=1:n
r1 = R(r1);
end
for k = 1:N
r1 = R(r1);
y1(k,:) = r1;
end
y1=sort(y1);
plot(f,y1,'k.','MarkerSize',1)
xlabel('f')
ylabel('r1');
set(gca,'xlim',[0 20]);
%here is the function
function r = R(r1)
define P : P = something something
r = zeros(size(P));
% piecewise function here
r(P<=0) = sqrt((Ri^2)*(1-P(P<=0)/P1).^-n1);
r(P>0) = sqrt((rimax^2)-(rimax^2-Ri^2)*(1-P(P>0)/P2).^-n2);
end
end
but the result is just a curve which I didn't expect
Anyone who could help me. I'm really confused.
Thank you!

Answers (0)

Products

Asked:

on 22 Jun 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!