how to plot graph?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Andreas Goser
el 14 de Ag. de 2014
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.
Respuestas (2)
Andreas Goser
el 12 de Ag. de 2014
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
el 14 de Ag. de 2014
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 comentarios
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!