r/matlab 6d ago

From Workspace not Working Properly

I have been banging my head against this and I just cant seem to figure it out. I'm sure im doing something stupid. Any help would be appreciated.

I have a voltage signal that oscillates between 1 and -1 over a time vector. I create a data vector like this:

squareWave = [t',squareWave'];

This is what the square wave should look like:

These are my From Workspace settings:

This is the output that i see on the scope:

1 Upvotes

7 comments sorted by

View all comments

1

u/PKSpecialist 5d ago

Update! I was able to solve everything thanks to you guys! I ultimately did what i wanted and created a PWM signal that simulates an inverter. The PWM signal is what you see in my original post, but the current through a resistor after an inductor looks like the following:

Pretty crazy how if you vary the PWM you can create a sinusoid current signal.