Trendfitting a series of downsamplings for comparisons
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nicholas Scott
el 26 de Ag. de 2022
Respondida: Binaya
el 5 de Oct. de 2023
Hi all!
I am looking to plot a series of downsamplings and then put an exponential to each to see if the downsampling manipulates data in an unfavorable way. The problem is, when attempting to plot multiple fit lines on one plot to compare the superimposed lines, I cannot control line style, color, nor name them, making a comparison pretty hard to read.
here is a snippet of the code, with an example of the full data, and a downsample of the data.
hold on
f = fit(u_image_time,transpose(median_intensity_pr),'exp2')
h=plot(f);
f1 = fit(downsample(u_image_time,3),transpose(downsample(median_intensity_pr,3)),'exp2')
h=plot(f1);
where this goes on for 5 downsamples with a total of 6 plot lines, not including their respective trendlines.
I was hoping to have a situation where the trend line and standard data would be the same color (or similar) with just different line styles, and have their corresponding titles displayed in a legend.
Below is kind of what I thought I'd do to accomplish it, but they only match up in color because i cannot control the trendline and it is defaulted to red.
f2 = fit(downsample(u_image_time,5),transpose(downsample(median_intensity_pr,5)),'exp2')
h=plot(f2);
h=plot(downsample(u_image_time,5),downsample(median_intensity_pr,5),'r', 'DisplayName', 'Downsample5');
xlim([1.4 30])
legend('location','best')
legend show
hold off
attached are the two .mats that will help this code run.
I appreciate all thoughts! Thanks!
Nick
0 comentarios
Respuesta aceptada
Binaya
el 5 de Oct. de 2023
Hi Nicholas,
I understand your requirement is to plot multiple down sampled and curve-fitted lines in a figure, each with distinct line styles and colors. Below, I have provided a sample code snippet that can serve as a reference:
hold on
f = fit(u_image_time,transpose(median_intensity_pr),'exp2')
h=plot(f,'b-');
f1 = fit(downsample(u_image_time,3),transpose(downsample(median_intensity_pr,3)),'exp2')
h=plot(f1,'r--');
Please find the documentation of plot function with linestyle and linecolor options here:
https://www.mathworks.com/help/matlab/ref/plot.html?searchHighlight=plot&s_tid=srchtitle_support_results_1_plot#btzitot_sep_shared-LineStyle:~:text=Line%20style%2C%20specified%20as%20one%20of%20the%20options%20listed%20in%20this%20table[BA1]
I hope this helps.
Regards
Binaya
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Multirate Signal Processing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!