필터 지우기
필터 지우기

Changing from 'bar' command to 'plot' command.

조회 수: 1 (최근 30일)
Shantanu K
Shantanu K 2013년 3월 16일
Double expansion chamber program:
l1=0.05;
l3=0.05;
l5=0.05;
l2=0.200;
l4=0.200;
d1=0.05;
d3=d1;
d5=d1;
d2=0.25;
d4=d2;
M=0;
S1=pi/4*d1*d1;
S3=S1;
S5=S1;
S2=pi/4*d2*d2;
S4=S2;
for z=1:4500;
k=2*pi*z/343;
SP1=[cos(k*l1) 1i*sin(k*l1); 1i*sin(k*l1) cos(k*l1)]; % 2X2 matrix
TP1=[1 0; 0 S2/S1];
SP2=[cos(k*l2) 1i*sin(k*l2); 1i*sin(k*l2) cos(k*l2)];% 2X2 matrix
TP2=[1 0; 0 S3/S2];
SP3=[cos(k*l3) 1i*sin(k*l3); 1i*sin(k*l3) cos(k*l3)];% 2X2 matrix
TP3=[1 0; 0 S4/S3];
SP4=[cos(k*l4) 1i*sin(k*l4); 1i*sin(k*l4) cos(k*l4)];% 2X2 matrix
TP4=[1 0; 0 S5/S4];
SP5=[cos(k*l5) 1i*sin(k*l5); 1i*sin(k*l5) cos(k*l5)];% 2X2 matrix
TLM=SP1*TP1*SP2*TP2*SP3*TP3*SP4*TP4*SP5; % 2X2 matrix
Sum=TLM(1,1)+TLM(2,2)+TLM(2,1)+TLM(1,2);
Mag=abs(Sum);
TL(z)=20*log10(Mag/2);
f(z)=z;
end;
figure(1)
bar(f,TL,'y');
xlabel('FREQUENCY in Hertz');
ylabel('TRANSMISSION LOSS IN dB');
title('Plot of TRANSMISSION LOSS Versus FREQUENCY');
I want to do this program using 'plot' command rather than 'bar' command. Its showing some errors such as >>too many input arguments.

채택된 답변

Matt J
Matt J 2013년 3월 16일
편집: Matt J 2013년 3월 16일
You probably have a non-builtin function called 'bar.m' or 'plot.m' somewhere on your path. Execute
>>which bar(f,TL,'y')
>>which plot(f,TL,'y')
in the workspace of your code to find out.
  댓글 수: 3
Matt J
Matt J 2013년 3월 16일
What happened when you did
>>which plot(f,TL,'y')
Image Analyst
Image Analyst 2013년 3월 16일
편집: Image Analyst 2013년 3월 16일
Try
>>which -all plot
and show us the result in the command window. Next tell us the exact line of code you're executing, plus copy and paste the exact error message (don't paraphrase it, we want the exact message).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by