Shading area between two functions
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jric
el 9 de Jul. de 2023
Comentada: Jric
el 11 de Jul. de 2023
Hi, I want to shade the area between these two functions but am confused how to use other answers with my code.
My code is as follows:
function [responseDif, slopeDif]=complexityMeasure(myinputfile1, myinputfile2)
load(myinputfile1)
F1=Fsoma;
x1=mean(F1);
load(myinputfile2)
F2=Fsoma;
x2=mean(F2);
responseDif=sum(abs(x1/max(x1)-x2/max(x2)));
slopeDif=sum(abs(diff(x1)/sum(diff(x1))-diff(x2)/sum(diff(x2))));
d1=diff(x1)/sum(diff(x1));
d2=diff(x2)/sum(diff(x2));
figure; semilogx(h,[(x1/max(x1))' (x2/max(x2))']); title 'response functions'
figure;semilogx(h(2:end),[d1' d2']); title 'slopes'
end
and both input files are loaded neurons with information about the soma and firing rate. The figure this output produces looks like:

Thanks so much in advance!
0 comentarios
Respuesta aceptada
Walter Roberson
el 9 de Jul. de 2023
ymax = max(d1, d2);
ymin = min(d1, d2);
x = h(2:end);
xfill = [x(:); flipud(x(:))];
yfill = [ymax(:); flipud(ymin(:))];
fillcolor = [.5 .5 .5];
hold on
fill(xfill, yfill, fillcolor);
hold off
3 comentarios
Walter Roberson
el 10 de Jul. de 2023
y1 = x1 ./ max(x1);
y2 = x2 ./ max(x2);
ymax = max(y1, y2);
ymin = min(y1, y2);
x = h;
xfill = [x(:); flipud(x(:))];
yfill = [ymax(:); flipud(ymin(:))];
fillcolor = [.5 .5 .5];
hold on
fill(xfill, yfill, fillcolor);
hold off
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!