So I basically have this function y which varies on a chosen number nabla. I have written a function that takes in a chosen number of nablas and plots the corresponding y value to a given x interval, here it is:
if truefunction nablaplot(n)%writing in the number n of inputs and creating a matrix
%calculating my matrix y which I will plot
for i=1:nnabla(i)=input(sprintf('Enter nabla value number %i: ',i));y(i,:) = 2.*x - 2.*x.^3 + x.^4 + (nabla(i)/6).*x.*(1-x).^3 ;end x=0:0.01:1; %step length
figurey1= 0*x; %x-axis
plot(x,y1,':black') %x-axishold onplot(x,y) %here I plot the number n of graphs
axis([0 1 -0.2 2]) %boundaries
hold offendend
This function prints the given number n of graphs into a single plot – which is what I want! But is there any way to plot n legends which states what nabla value each graph has?
Best Answer