My experiences against Zelda mostly come from free for all situations, which would be of little use here, but I have a little one on one match up experience. The experience I have does come from a Zelda main though, so maybe it will be useful.
Zelda's forward smash and up smash really hurt sonic from my experience. The forward smash seems to always outreach sonic's spin dashes and dash attack and the up smash can hit him even off of the ground and can kill at a decent percent (110% or so). The same goes for sonic's aerials. Those smashes can outreach him pretty much each time. Zelda needs to be very careful here though. Sonic's fake out mindgames with his spin dashes can really mess her up sometimes. If a zelda wiffs an attack, then sonic will almost always be able to punish her due to the relatively long after lag on all of her attacks. She also can't use Din's fire to force an approach on Sonic. Sonic is too fast on the ground for her to do that. Not to say that it will never work, I just feel as though it's not a very safe option.
Zelda's aerial game is not as good as sonic's though. Her fair and bair don't have enough speed and distance to beat out Sonic. However, it is also not easy to juggle zelda with sonic. Using the Nayru's Love as you fall can usually provide a hitbox that is large enough that sonic can not penetrate it easily. His fair will almost never reach her in this situation. Dair can, but an occurance where that will happen is pretty rare. Bair can not reach through to her through the middle, but I think thath e can hit her through the top and bottom of it. A well placed up air from Sonic can reach her and that is one of Zelda's biggest problems. A well timed Farorie's Wind can get her out of harm's way of the up air, but the landing lag can get her punished just as badly. To avoid being destroyed by up air stuff, a zelda needs to mix up mid air dodges and farorie's wind in my opinion.
It's also very hard for Zelda to KO sonic off the side of the screen. Again, her fair and bair rarely will beat sonic from my experience and her f smash needs to reach like 145% or something to be powerful enough. Of course, it pretty much goes without saying that Zelda will rarely ever KO sonic off the bottom of the screen (Don't worry its not just a problem with zelda, its just that it doesn't happen much to sonic.) That being said. If you get the electricy powerful version of her dair (that i recently just learned existed), then, you just might be able to spike him hard enough sometimes. For Zelda to get the kill, the best way is to aim for the top of the screen using up smashes and up airs. The huge hit box on the up air is very helpful for this.
All in all, if you can read a sonic well enough and if you can find ways to use zelda's larger hitboxes to beat out sonic's attacks, than Zelda can beat sonic no problem. But if you are against a smart sonic who has a lot of experience and mindgames up his sleeves, than you are in for one very rough battle.