At heart, "The Yellow Wallpaper" is a critique of women's position in nineteenth-century society. The narrator of the story suffers from what seems like post-partum depression, and she is forced by her husband and her doctor to take the traditional "rest cure" for all female ailments. This nameless woman is forbidden to read, write, or leave her room, and her thoughts begin to prey upon her.
This character's helplessness illustrates how powerless women were during this time in history. The woman has no money of her own, no social identity beyond being her husband's wife, and no control over her own actions. While Gilman's original audience tended to view the piece as merely a "horror story" about madness, it is regarded today as a landmark of feminist fiction.
Having suffered from continuous nervous breakdown, and beyond, which nearly led to melancholia, and not having been treated the right way, I think that Charlotte Perkins Gilman is trying to make a statement. She wants to show the world how it is to be in this, what I would conclude out of the story, horrid situation. No one can really know how it is to feel trapped in a way, and I think this story has reflected a clear picture of how serious the situation is.
As she was given the wrong treatment and was nearly driven crazy, in my opinion the second reason why she wrote The Yellow Wallpaper is to avoid other patients coming into this horrible situation and frankly it did work! Patients with this illness do get treated in a different way then that they used to get treated.
I would say that Charlotte Perkins Gilman has achieved her goal.