Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Matlab code help with fourier series square wave

Status
Not open for further replies.

jddilla2

Newbie level 1
Newbie level 1
Joined
Sep 25, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,284
sgdfgsdfgff
 
Last edited:

Hey jddilla,

The problem was immediately apparent in MATLAB's workspace window; your script creates a stack of variables and two vectors: t and y ...and they were of different length (1 x 101 and 1 x 100 respectively).
Without trying to understand your code, differing length vectors always raise a warning flag in my mind since the operations you can do with them are restricted. Since you received the warning about mismatched matrix dimensions, the "+" operator is attempting to do something it can't (like add them).

Shortening one vector or lengthening the other was worth a try...
Since tinkering with y meant having to understand your loop, I adjusted the limits of t.

Changing: t=0:0.001323:0.1323;
To: t=0:0.001323:(0.1323-0.001323);

Did the trick. I now have 100 y values that probably mean more to you than they do to me!
Enjoy :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top