brianj320 All American 9166 Posts user info edit post |
i'm tryin to plot a relationship between 2 variables on a graph within matlab. i have a large expression i'm tryin to put in that includes 5 values, 4 known and the other that will be a range. i keep getting a numerical answer for the large expression which is not supposed to happen. anyone know why that is happening?
this is my coding:
a=0.1 m=2000 c=1.2e5 k=4e6 w=(-50:.1:50); z=a*[(k.^2+(c*w).^2)/((k-m*w.^2).^2+(c*w).^2)]^.5;
z = 0.1189
when i evaluate z i get that numerical answer and i'm not supposed to because it is supposed to be a graphical comparison of z versus changing w. 6/9/2006 11:12:49 PM |
virga All American 2019 Posts user info edit post |
be sure that you are using []'s for a vector, and ()'s for parenthetical multiplication...
try..
a=0.1 m=2000 c=1.2e5 k=4e6 w=[-50:.1:50]; z=a*((k.^2+(c*w).^2)/((k-m*w.^2).^2+(c*w).^2))^.5;
[Edited on June 9, 2006 at 11:42 PM. Reason : nmnm] 6/9/2006 11:38:31 PM |
joe17669 All American 22728 Posts user info edit post |
.
[Edited on June 9, 2006 at 11:40 PM. Reason : ^ beat me to it] 6/9/2006 11:39:51 PM |
virga All American 2019 Posts user info edit post |
oh, use ./ for your division as well. 6/9/2006 11:45:18 PM |
brianj320 All American 9166 Posts user info edit post |
that was it! the ./ was screwin me up
thanks so much
[Edited on June 9, 2006 at 11:48 PM. Reason : .] 6/9/2006 11:46:50 PM |
brianj320 All American 9166 Posts user info edit post |
i'm doing some work with Gibb's Phenomenon and square wave stuff and i've gotten this:
how do i zoom out so i can see the entirety of the square wave? that view is just a closeup of that 1 section but i need to see the whole thing. and yes, i've tried the zoom out tool within the plot window but wont let me go any further.
[Edited on June 11, 2006 at 6:06 PM. Reason : .] 6/11/2006 6:05:57 PM |
brianj320 All American 9166 Posts user info edit post |
bttt for square wave question 6/11/2006 7:43:02 PM |
virga All American 2019 Posts user info edit post |
doesn't really look like a square wave....but anyways, the gibbs phenomenon presents itself when you add many, many terms to the fourier series. for the square wave, the fourier coefficients are sinc's.
for a very cursory answer to your question, if you want to "zoom out", you need to make your dependant variable longer in length. you have it running from 0 to 60 ... increase the length to 120 or whatever. 6/11/2006 7:54:56 PM |