Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 587899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:15:40+00:00 2026-05-13T15:15:40+00:00

hi i was doing the following in matlab values = [0;1;0;0;1;0;1;0]; % can contain

  • 0

hi i was doing the following in matlab

    values = [0;1;0;0;1;0;1;0];   % can contain only 0s and 1s 
    h = modem.oqpskmod; 
    y = modulate(h, values); 
    g = modem.oqpskdemod(h); 
    z = demodulate(g,y); 
    BER = sum(logical(values(:)-z(:)))/numel(values); % thanks to gnovice!

before calculating the BER, do you think that i have to convert the array z into array of 1s and 0s only… for example, my z may consist of 3s and 0s, then do i have to convert all numbers bigger than 0 to 1s and all 0s unchanged. so that at the end i get the correct comparison for the BER?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T15:15:41+00:00Added an answer on May 13, 2026 at 3:15 pm

    This depends on how you want to do the comparison of the input and output. The code I gave you for computing the BER will count any difference between the input and output as an error. So, a value of 3 for an output and a corresponding 1 for an input are counted as different.

    If you want to compute the BER in another way, here are a couple more options you could use. Each of these assumes values contains only zeroes and ones:

    • Count any non-zero output value as a 1: In this case, you would use the function LOGICAL to convert any non-zero value of z (i.e. the values 3, 0.5, -1, etc.) to a 1, leaving the values that are exactly zero unchanged:

      BER = sum(values(:)-logical(z(:)))/numel(values);
      
    • Count positive values as 1 and negative values as 0: This solution just uses a comparison operator instead of LOGICAL:

      BER = sum(values(:)-(z(:) > 0))/numel(values);
      

    You may also want to try setting the 'OutputType' property of the modem.oqpskdemod object to 'bit' to ensure a binary output. Then you shouldn’t have to do anything to z:

    ...
    g = modem.oqpskdemod(h,'OutputType','bit'); 
    z = demodulate(g,y);
    BER = sum(values(:)-z(:))/numel(values);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can somebody explain me what the following bit of code in Matlab is doing?
In matlab, I can create a structure array (struct) by doing the following. person.name
In my MATLAB scripts I've been doing something similar to the following to read
I am doing vlfeat in Matlab and I am following this question here .
I am looking for the Matlab way of doing the following: > merge(2:4,3:7) x
I my index lets say I have field field named full_name. I'm doing following
While doing the following simple example, I found the following difficulties As the title
After doing the following test: for( i = 0; i < 3000000; i++ )
I'm currently doing the following to compensate for boolean's not mapping well to radio
I need help doing the following: a preprocessor macro label(x) shall output #x, e.g.,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.