I'm trying to plot a curve using the equation
curve = (1/(sqrt(2*pi*s.^2))* exp(-((tempAnomaly-m).^2)/(2*s.^2)));. I have my program split into two functions, but when calling the calculating function from the main function, I can't seem to access the 'curve' variable even though it is the output value. I am getting the error "Undefined function or variable" on line 4 (
Any tips on how to access this variable so I'm able to plot it would be great. Thanks!
function TempAnomaly() tempAnomaly = linspace(-5, 5, 1000); normalDist(0.4, 0.1, tempAnomaly) plot(tempAnomaly, curve); end function curve = normalDist(m, s, tempAnomaly) curve = (1/(sqrt(2*pi*s.^2))* exp(-((tempAnomaly-m).^2)/(2*s.^2))); end