I was wondering how to add a label to a graph of multiple PDEs.
I want to label each line of the graph differently.
The functions I have are as follows:
function [pl,ql,pr,qr] = heatbc(xl,ul,xr,ur,t)pl = ul;ql = 0;pr = ur;qr = 0;endfunction u0 = heatic(x)u0 = x.*(1-x);endfunction [c,f,s] = heatpde(x,t,u,dudx)c = 1;f = dudx;s = 0;end
With the main code being as such:
x = linspace(0,1,10);t = [0 0.1 0.2 0.3];m = 0;sol = pdepe(m,@heatpde,@heatic,@heatbc,x,t)u = sol(:,:,1);plot(x,u); hold on;
So far the graph looks as such:
I would just like to know how I would code a legend that labels the purple, orange, red and blue lines individually.
Thanks in advance!
Best Answer