Trying to plot, no figure comes up
이전 댓글 표시
Hi, I'm trying to plot a figure, however when I press 'Run Code' no plot comes up - I've input the same code into the command window and it worked, also into a new program and a figure came up no problem, however when I try to run this code as a section (part of a school assignment) nothing comes up - even if I add a line of code that is meant to be provide an error (eg just ffffff), still no error comes up and nothing runs, could someone please help? Relevent code below
function [] = conc ()
% Set the values for the equation
t = 86400 ;
x = [ 0: 0.02 : 2 ] ;
v = 10^-5 ;
D = 10^-7 ;
% Input the equation
c = (1/ sqrt(4 * pi * D * t )) * exp( - ((x) - (v * t)).^2 / 4*D) ;
% Plot the figure, labelling title + axis and setting limits for a suitable
% scale
figure(1) ;
plot(x, c, 'r-') ;
ylabel('Concentration (m^2/s)') ;
xlabel('Distance from the Source (m)') ;
title ('The concentration of a substance with distance from an initial source') ;
xlim ([0 2]) ;
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
