how to plot graph?

2 ビュー (過去 30 日間)
deep kandpal
deep kandpal 2014 年 8 月 12 日
回答済み: Andreas Goser 2014 年 8 月 14 日
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
Andreas Goser 2014 年 8 月 12 日
And your question is?
Andreas Goser
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
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.
  1 件のコメント
deep kandpal
deep kandpal 2014 年 8 月 12 日
i am new in matlab sir can you fixed it?

サインインしてコメントする。


Andreas Goser
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.

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by