how to plot graph?
조회 수: 2 (최근 30일)
이전 댓글 표시
clear all
Na=6.022e23 ;
sigma_C=5.33; % b
sigma_water = 103.66%
S = 10^-24*[sigma_c sigma_water];
rho(1)=1.6; %carbon g/cm^3
rho(2)=1 ; %water g/cm^3
M = [12 18.015];
for i=1:2
sigma(i) = s(i)*rho(i)*Na/M(i);
end
x=linspace(0/15);
for j=1:2
for j=1:100
I(i,j)=exp(-sigma (j)*x(i));
end
end
figure
hold on
plot (x,I(:1),'K')
Plot (x,I(;2) , 'k:')
x lable ( 'distance(cm)')
y lable ('Fractional Intensity')
legend ('Graphite,' 'water')
댓글 수: 2
Andreas Goser
2014년 8월 14일
Are you a student in engineering or sciene? Then your really really need to learn such things. Not just because it is MATLAB. It is about programming.
Open this code in the MATLAB Editor and debug it. I will give you two sarting points as answer below.
답변 (2개)
Andreas Goser
2014년 8월 12일
Your code contains >5 small syntactic errors and typos. Please try to execute yourself line by line and make the necessary corrections starting with sigma_c vs sigma_C. Then post the code with the questio.
Andreas Goser
2014년 8월 14일
First error example
Error: File: ....m Line: 20 Column: 12 Unexpected MATLAB expression.
This is
plot (x,I(:1),'K')
This is simply not existing syntax. Maybe you want to do:
plot (x,I(:,1),'K')
But nobody can fix this for you as nobody knows what you plan to do.
Next line: plot instead of plot. Mind case sensitivity.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!