MATLAB: How can i solve the error “many input arguments in the following code”

too many input arguments

clear all %clear the work space
close all %close all the active figures
clc %clear the command window
% main code to be executed
syms x
global p_old
NoUE = 3; %Number of User Equipments in the system design
for i_rate = 1:1:39
Rate(i_rate) = 5 + i_rate*5 %gives the maximum rate
w = [10 10 10 ];
r_min = [ 0 0 0 ]; %give the intital new min rate of optimization
delta = 1;
time = 0;
%User Equipment (UE) Rates
while (delta > 0.02)
time = time + 1;
w_old = w;
t(time) = time;
p(time) = eNodeB(w,Rate(i_rate)); % received from the eNodeB
for i = 1 : NoUE
pp = p(time);
ii = i;
soln(i) = fzero(@(x) utility_UE(x, ii, pp), [.002 1000]);
r_opt(i) = max(soln(i), r_min(i));
w(i) = r_opt(i) * p(time);
if abs(w_old(i) – w(i)) > (5 .* exp (-0.1 * time)) %(10./time)
w(i) = w_old(i) + (5 .* exp (-0.1 * time)) .* sign(w(i)-w_old(i));
end
end
w_sim(time,:) = w;
r_sim(time, 🙂 = w_sim(time, :)./p(time);
delta = max (abs(w-w_old));
end
t_final = time;
r_ss(i_rate, 🙂 = r_sim(time, :);
w_ss(i_rate, 🙂 = w_sim(time, :);
p_ss(i_rate, 🙂 = p(time);
time_ss(i_rate) = time;
time_ss2(i_rate) = 1;
% application rates
wUE = [ 10 10 10 ];
w_oldUE = [100 100 100 ];
r_minUE = [0 0 0 ];
deltaUE = 1;
for i = 1 : NoUE
time = 0;
while (time < 20)
time = time + 1
t(time) = time;
ii = i;
ii2 = i + NoUE;
w_oldUE(ii) = wUE(ii);
w_oldUE(ii2) = wUE(ii2);
R2 = r_sim(t_final, ii);
pUE(time, ii) = UE(ii, wUE, R2);
pUE(time, ii2) = pUE(time, ii);
ppUE(ii) = pUE(time, ii);
soln(ii) = fzero(@(x)utility_UE(x, ii, ppUE(ii)), [.0002 100]);
r_optUE(ii) = max(soln(ii), r_minUE(ii));
wUE(ii) = r_optUE(ii)*ppUE(ii);
soln(ii2) = fzero(@(x)utility_UE(x, ii2, ppUe(ii2)), [.0002 100]);
r_optUE(ii2) = max(soln(ii2), r_minUE(ii2));
wUE(ii2) = r_optUE(ii2)*ppUE(ii);
if abs (w_oldUE(ii)-wUE(ii)) > (5.*exp(-0.1*time))
wUE(ii) = w_oldUE(ii) + (5.*exp(-0.1*time)).*sign(wUE(ii)-w_oldUE(ii));
end
if abs (w_oldUE(ii2)-wUE(ii2)) > (5.*exp(-0.1*time))
wUE(ii) = w_oldUE(ii2) + (5.*exp(-0.1*time)).*sign(wUE(ii2)-w_oldUE(ii2));
end
w_simUE(time, ii) = wUE(ii);
w_simUE(time, ii2) = wUE(ii2);
r_simUE(time, ii) = w_simUE(time, ii)./pUE(time, ii);
r_simUE(time, ii2) = w_simUE(time, ii2)./pUE(time, ii2);
deltaUE = max (abs(wUE-w_oldUE));
end
end
r_ssUE(i_rate, 🙂 = r_simUE(time, :);
w_ssUE(i_rate, 🙂 = w_simUE(time, :);
end
%to plot UE Rates
plot(Rate, r_ss)
xlabel('Rate');
legend('UE1', 'UE2', 'UE3');
ylabel('UE Rates');
%%%% Plot UE bids
figure;
plot(Rate, w_ss);
xlabel('Rate');
legend('UE1','UE2','UE3');
ylabel('UE Application Rates Bid');
figure;
plot(Rate, time_ss, Rate, time_ss2)
xlabel('Rate');
ylabel('Iterations');
%%plot application Rates
figure;
plot(Rate, r_ssUE)
xlabel('Rate');
legend('UE1 App1','UE2 App1','UE3 App1');
ylabel('Application Rates');
%plot Application Rate
plot(Rate, w_ssUE)
xlabel('Rate');
legend('UE1 App1','UE2 App1','UE3 App1');
ylabel('Application Bids');
figure;
plot(Rate, time_ssUE)
function [p] = utility_UE(w)
global p_old R
R = 180;
p = sum(w)./R;
end
function [p] = eNodeB (w, Rate)
R = Rate;
p = sum(w)./R;
end

Best Answer

Here is your function
And this is how you are calling it
Related Question