plot a function wit cos

22 views (last 30 days)
Yann
Yann on 11 Jan 2023
Commented: Yann on 11 Jan 2023
here is my code but when i running it i get an error
f=(0:10);
%f0=5*10^9;
c=(3*10^8);
t=5*10^9;
w=2*pi*f;
wt=w*t;
k=(wt/c);
z=(0.75:30);
r12=0.29;
%x=0.094*cos*(k*z);
y=0.094*cos*(((100*pi)/3)*z);
%rin=abs(y);
plot(f,y);
xlabel("Frequency",'fontsize',5);
ylabel("|Γin|",'FontSize', 5);
title("Input reflection coefficient as a function of frequency","fontsize",7.5);
grid on;
that the errore
Error using cos
Not enough input arguments.
Error in project (line 11)
y=0.094*cos*(((100*pi)/3)*z);
i ty to fix it but tey stil have a erro at this line

Answers (2)

Torsten
Torsten on 11 Jan 2023
f=(0:10);
%f0=5*10^9;
c=(3*10^8);
t=5*10^9;
w=2*pi*f;
wt=w*t;
k=(wt/c);
z=(0.75:30);
r12=0.29;
%x=0.094*cos*(k*z);
y=0.094*cos(((100*pi)/3)*z);
%rin=abs(y);
plot(z,y);
xlabel("Frequency",'fontsize',5);
ylabel("|Γin|",'FontSize', 5);
title("Input reflection coefficient as a function of frequency","fontsize",7.5);
grid on;

Voss
Voss on 11 Jan 2023
Maybe this
y=0.094*cos*(((100*pi)/3)*z);
should be this
y=0.094*cos(((100*pi)/3)*z);
or, without the extra parentheses:
y=0.094*cos(100*pi/3*z);

Community Treasure Hunt

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

Start Hunting!