Why do some vegetables taste sweeter when cooked but not others?

I was making a vegetable stir-fry last night and noticed that onions have a sharp flavor while raw, but seem to sweeten as they cook. Bell peppers (red ones, in this case) have a sweet flavor when raw, but seem to taste less sweet after they’re cooked, ending up with an almost bitter flavor (not a bad one, mind you, but noticeably less sweet than they started).

Does anyone have an explanation for this apparent contradiction? I tried doing a little bit of research online, but didn’t find anything readily.

Onions, carrots, and some other vegetables, get sweeter when you cook them because you break down the cell walls, releasing sugars that would have otherwise been inaccessable. In the case of onions, you also break down lots of the sharp, bitter compunds, along with the ones that make you weepy. I don’t know why this isn’t so with peppers.

IANAChef but I think this is what’s known as carmelization? Or am I totally wrong?

Carmelization is simply the “charring” of existing sugars in the food. I don’t think this process in and of itself would add a sweet flavor, but rather would tend to alter the natural sweetness that is already there.

I definitely think GilaB hit the nail on the head with respect to onions. I believe a lot of the sharpness there comes from volatile compounds that evaporate away upon cooking, leaving a higher percentage of sugar behind as the primary flavor (i don’t have a cite for this, it just seems logical). What i still don’t understand is why bell peppers seem to get less sweet when cooked. The sugars in peppers wouldn’t be volatile, so they’re still in the peppers after cooking, AFAIK. Why don’t they taste as sweet as raw peppers?

You can also have hydrolysis of complex sugars and starches. Take table salt – sucrose oe alpha-D-glucosido-beta-D-fructofuranoside (or as we call it in the lab “a glucose tackes onto a fructose”)-- it is easily (partially) hydrolyzed by extended boiled or heating, so you end up with two (simple) sugar molecules where you once had one (compound) sugar molecule. The fructose alone is much sweeter, molecule for molecule, than the original sucrose, so the glucose is just a bonus.

Of course, different compound sugars, starches (which re even larger clusters of simple sugar subunits) and other sugar-containing compounds (e.g. the deoxyribose and ribose in DNA and RNA are sugars) vary in how easily they are broken down. Cellulose (wood, plant cell wats, “fiber”) is nothing but a branching chain of glucose subunits, but it’s very hard to break down. Certain bacteria can do it, and cows (among other organisms, like termites) use cellulose-digesting bacteria in their gut to extract nourishment from cellulose – glucose is “blood sugar”, the primary internal bodily fuel of mammals like cows and humans.

So some vegetables may have a lot of sugar tied up pretty permanently in “fiber” or plant cell walls, while others (like sugar beets) may have complex sugars lor starches that break down fairly easily to sweet sugar subunits. As noted by others, other chemical reactions may also modify the flavor affecting perceived sweetness

er – “table sugar”, not “table salt” – D’oh!