Sign in

username:

password:



Not a member?

Search matlab



Search tips

Subscribe to matlab



matlab by Keywords

Atanh | Autocorrelation | Bandpass Filter | C++ | Conv | Database | Deconv | Excel | FFT | Filter | Filtering | FIR | Fourier Transfrom | FSK | Gaussian Noise | Haykin | IFFT | Image | Java | LFSR | LMS | LPC | MEX | OFDM | QPSK | Radix | Random | Sampling | Segmentation | Simulink | Visual Basic | Waveform | Wavelet


Discussion Groups

Discussion Groups | Matlab DSP | Plotting an equation;

Technical discussion about Matlab and issues related to Digital Signal Processing.

  

Post a new Thread

Plotting an equation; - pnalelia - Aug 22 8:56:49 2008



Hi people,

I am trying to plot the following equation in matlab. I dont expect
the plot to be a straight line since the equation is not a straight
line equation. I am on a timeline of 25 hours so please help.

y=1+cos(2*a)/1+1cos(2(a-i))

where;
         a ranges from angles 0 to 180
         i is a constant angle whenever y is calculated input at the
matlab console ranging from 0 to 180.

here is my code;

i=input('The angle i:');
a=0:180;
    
  num=1+cosd(2*a);
  dem=1+cosd(2*(i-a));
       y=num/dem;
plot(a,y)

please help


(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Plotting an equation; - Jamil Abou Saleh - Aug 22 10:38:21 2008

Why r u using Cosd instead of cos !! i thought from the equation that u want
to use cosine !!!
if cosine is what u r looking for ... Try this out !!

i=input('The angle i:');
a=0:1:180;
num=1+cos(2*a);
dem=1+cos(2*(i-a));
y=num./dem;
plot(a,y);
Jamil

On Thu, Aug 21, 2008 at 3:02 PM, pnalelia <p...@yahoo.com> wrote:

>   Hi people,
> I am trying to plot the following equation in matlab. I dont expect
> the plot to be a straight line since the equation is not a straight
> line equation. I am on a timeline of 25 hours so please help.
>
> y=1+cos(2*a)/1+1cos(2(a-i))
>
> where;
> a ranges from angles 0 to 180
> i is a constant angle whenever y is calculated input at the
> matlab console ranging from 0 to 180.
>
> here is my code;
>
> i=input('The angle i:');
> a=0:180;
>
> num=1+cosd(2*a);
> dem=1+cosd(2*(i-a));
> y=num/dem;
> plot(a,y)
>
> please help
>
>  
>

-- 
**********************************************
Jamil Abou Saleh
Masters of Applied Sciences
Electrical and Computer Engineering
University of Waterloo

Mailing Address:
196 WestMount Road North, Apt# 413
Waterloo, Ontario, Canada
N2L3G5

Home# +1 (519) 7728701
**********************************************



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )

Re: Plotting an equation; - Laiq Azam - Aug 23 22:41:06 2008

i think because he wants to work in degrees, instead of radians (as he wrote
0 to 180, instead of 0 to pi).

On Fri, Aug 22, 2008 at 9:05 AM, Jamil Abou Saleh <j...@gmail.com
> wrote:

>    Why r u using Cosd instead of cos !! i thought from the equation that u
> want to use cosine !!!
> if cosine is what u r looking for ... Try this out !!
>
> i=input('The angle i:');
> a=0:1:180;
> num=1+cos(2*a);
> dem=1+cos(2*(i-a));
> y=num./dem;
> plot(a,y);
> Jamil
>
> On Thu, Aug 21, 2008 at 3:02 PM, pnalelia <p...@yahoo.com> wrote:
>
>>   Hi people,
>> I am trying to plot the following equation in matlab. I dont expect
>> the plot to be a straight line since the equation is not a straight
>> line equation. I am on a timeline of 25 hours so please help.
>>
>> y=1+cos(2*a)/1+1cos(2(a-i))
>>
>> where;
>> a ranges from angles 0 to 180
>> i is a constant angle whenever y is calculated input at the
>> matlab console ranging from 0 to 180.
>>
>> here is my code;
>>
>> i=input('The angle i:');
>> a=0:180;
>>
>> num=1+cosd(2*a);
>> dem=1+cosd(2*(i-a));
>> y=num/dem;
>> plot(a,y)
>>
>> please help



(You need to be a member of matlab -- send a blank email to matlab-subscribe@yahoogroups.com )