function SpaceCurve(t_min, t_max, N_t, XString, YString, ZString,ColorString) % Plots a parametrized curve (x,y,z) = f(t) in three dimensional space, % where F: R --> R^3. % The parameter t takes its values in the range % t_min <= t <= t_max, and is discretized using N_t grid points % The function F is specified by three strings, XString, YString, and ZString % % For example to plot the curve % x(t) = cos(t), y(t) = sin(t), z(t) = t % set % XString = 'cos(t)', YString = 'sin(t)', and ZString = 't' % The color of the curve is given by ColorString with allowable % values 'y', 'm', 'c', 'r', 'g', 'b', 'w', and 'k' % See help plot for more information on colors. % % Typical call: % % SpaceCurve(0,2*pi,100,'cos(t)','sin(t)','t','b') t = linspace(t_min,t_max,N_t); XFunction = inline(XString); YFunction = inline(YString); ZFunction = inline(ZString); X = 0.*t + XFunction(t); Y = 0.*t + YFunction(t); Z = 0.*t + ZFunction(t); plot3(X,Y,Z,'linewidth',2,'color',ColorString) % This gets the handle for the current axis hax=gca; % This sets the font name and size for all the text on the plot, including % tick labels and axis labels. set(hax,'fontname','helvetica','fontweight','bold','fontsize',20); xlabel('x') ylabel('y') zlabel('z') grid on