Trying to plot, no figure comes up
Afficher commentaires plus anciens
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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
