Over the weeks and months ahead, markets will watch Fed Chair Janet Yellen and President-elect Donald Trump to see if she resigns, he asks her to resign, or they find a way to coexist.

Trump harshly criticized Yellen during the campaign, saying at one point "I think she is very political and to a certain extent, I think she should be ashamed of herself. Because it is not supposed to be that way,'' he said.

Few Fed observers could recall a presidential nominee so openly and harshly criticizing the Fed or the Fed chair, making some question whether Yellen can continue in the job.

Related: Trump Win Casts Doubt on a Fed Rate Hike

"I think it's plausible that she would find this an intolerable situation where she not only doesn't have the confidence of the president, but that he thinks she's undermined the credibility and independence of the Fed," said Jimmy Pethokoukis, an economic policy analyst at the American Enterprise Institute and a CNBC contributor.

The Fed declined to comment.

How will Trump handle people he targeted?

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Presidents meet periodically with Fed chairs and Fed chairs meet frequently with Treasury secretaries. Given what's been said by Trump, unless an olive branch is extended, such meetings would seem awkward at best and dysfunctional at worst.

How Trump handles his relationship with Yellen could ultimately determine what she decides to do. Continuing criticism would appear to make her position untenable, especially since the Federal Reserve has few allies in Congress. It will also be among the most critical bellwethers of how the president-elect navigates repairing relationships with the many targets of his harsh campaign.

David Wessel, director of the Hutchins Center on Fiscal and Monetary Policy, said Trump needs to answer the question if he "respects the institutions of American democracy and values the independence of the Fed as (presidents) Bush, Obama and Clinton."

He thinks criticism of Yellen would "stiffen her spine and financial markets would stand behind her. ... No way she resigns," Wessel said.

Yellen has shown herself in congressional testimony to rarely back down on questions about the Fed's independence and has strongly objected to criticism that the central bank's decisions were political.

It's complicated

Yet the relationship will commence at a difficult time. The Fed put off interest rate hikes several times this year, in part because of the election. It was those delays that led in part to Trump's criticism of Yellen playing politics. But Wessel said, "In my experience, there are not many people who get elected president who press the Fed to raise interest rates."

One of the bets in markets is that, as Krishna Guha, vice chairman of Evercore ISI, said, "The pragmatic Trump" is more likely to emerge and govern rather than "the populist Trump." The president-elect, Guha said, has no incentive to pursue a fight with Yellen, a central figure in the stability of the global economy.

Guha, a former senior official at the Federal Reserve Bank of New York, said Yellen would be "unlikely to resign because of her really strong sense of responsibility to the institution." The Federal Reserve is technically independent of the executive branch. The Fed chair is appointed by the president and approved by the Senate but the term does not overlap.

Time isn't on Trump's side

Yellen's term is up in February 2018, about 16 months away. It would be difficult to nominate and gain approval of a Fed chair much before her term expires.

Yet there's precedent. The administrations of Richard Nixon, Ronald Reagan and George H.W. Bush all worked in one way or another to oust a Fed chairman.

In addition to appointing a new chair, Trump will have an opportunity to put a strong imprint on the Fed. Two governorships are vacant on the board already that won't be filled by President Barack Obama and the job of vice chair for supervision of financial regulation remains unfilled. Other governors could also resign, as many tend to stay in their positions for only a share of their 14-year terms.

"The only reason Yellen would quit is if (Trump) put people on the board she found offensive. Or she was being outvoted," Wessel said.