I would like to insert a logo in the top center of the first page, before the title and the authors name. If I use the command \begin{figure} it turns out another new page before the title with the image. I have also tried not to use \begin{figure}. The main text code is below:
%\documentclass[5p,sort&compress]{elsarticle}
\documentclass[final,5p,times,twocolumn,authoryear]{elsarticle}
\makeatletter
\def\ps@pprintTitle{%
\let@oddhead@empty
\let@evenhead@empty
\def@oddfoot{\footnotesize\itshape
\hfill\today}%
\let@evenfoot@oddfoot}
\makeatother
\usepackage{dcolumn}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{cleveref}
\usepackage{textcomp}
\usepackage{mathtools}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage[fixlanguage]{babelbib}
\renewenvironment{abstract}{\global\setbox\absbox=\vbox\bgroup
\hsize=\textwidth\def\baselinestretch{1}%
\noindent\unskip\textbf{Abstract}
\par\medskip\noindent\unskip\ignorespaces}
{\egroup}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{caption}
\usepackage{booktabs}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
\usepackage{caption}
\usepackage{listings}
\usepackage{gensymb}
\usepackage{xcolor}
\usepackage[title]{appendix}
\usepackage{appendix}
\usepackage[toc,page]{appendix}
\usepackage{bm}
\usepackage{siunitx}
\sisetup{
exponent-product = \cdot,
output-decimal-marker = {,},
separate-uncertainty = true,
per-mode = symbol,
group-digits = false,
}
\usepackage{graphicx}
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{2}
\setcounter{totalnumber}{10}
\usepackage{flafter}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[colorlinks=true,allcolors=blue]{hyperref}
\usepackage{float}
\restylefloat{table}
\usepackage{floatrow}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{chemformula} %chemical formulas can be written more easily using \ch
\usepackage[version=4]{mhchem}
\usepackage{amsmath} % lar deg dele opp equations
\usepackage{mathtools} % dele opp eq.
\usepackage{titlesec}
\pagestyle{fancy}
\fancyhf{}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
%For at section, subsection og subsubsection skal bli deecent
\titleformat{\section}
{\normalfont\fontfamily{phv}\fontsize{12}{15}\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
{\normalfont\fontfamily{phv}\fontsize{10}{13}\bfseries}{\thesubsection}{1em}{}
\titleformat{\subsubsection}
{\normalfont\fontfamily{phv}\fontsize{10}{13}\selectfont}{\thesubsubsection}{1em}{}
\urlstyle{same}
\begin{document}
\begin{frontmatter}
\centering\includegraphics[width = .8\linewidth]{img/logo-polimi_600x250.png}
\title{Laboratory experiment 1: Magnetic Nanoparticles}
\author{}
\address{}
\begin{abstract}
text
\end{abstract}
\end{frontmatter}
\input{text/01_Introduction}
\input{text/02_Materials&methods}
\input{text/03_Results&discussion}
\input{text/04_Conclusion}
\makeatother
\bibliographystyle{babunsrt}
\bibliography{references}
\end{document}


\inputs, since other people don't have the file, specially when they are not related to the question. – FHZ Mar 15 '22 at 17:58appendixthree times before you do everything else. If you're making this many changes, are you sureelsarticleis the right document class? – frabjous Mar 15 '22 at 19:03