How can I solve this problem?
Afficher commentaires plus anciens
I have added 2 different MATLAB files where "receive_cdm.m" is my main code and "y_send.mat" is a file I am getting some values from it and loaded it in main code section.
If you look at the code then I have assigned 1 parameter c1. Forget about other parameters.
The following tasks are explained in the code.
I have done it with proper MATLAB commands and equations.
But, I am getting error when I calculate it manually and matching it with MATLAB calculations. (What I should get and what I am getting from MATLAB)
Can anyone check my code, please..?
It would be very helpful for me.
12 commentaires
KSSV
le 5 Jan 2021
You should specify your error.
Noman Abir
le 5 Jan 2021
Rik
le 5 Jan 2021
What KSSV means is that you should post the error message.
Noman Abir
le 5 Jan 2021
Noman Abir
le 5 Jan 2021
There is no error when I run your code. Moreover: the result of bsxfun is exactly as expected:
S=load('y_send.mat');y_send=S.y_send;
c1 = [ 1 1 1 1 ];
%row to row and bit to bit multiplication of y_send and c1.
demultiplex_data_y1 = bsxfun(@times, c1, y_send);
isequal(demultiplex_data_y1, y_send)
Noman Abir
le 5 Jan 2021
That is actually what that last line of code does: it checks if demultiplex_data_y1 and y_send are equal. They are, just as expected. The screenshots you posted look like you were just shifted by 1 row when you made the screenshot.
You need to be careful with your wording: the word 'bit' has a specific meaning: a one or a zero as stored in the actual computer memory. The multiplication times is doing doesn't multiply bit by bit, but element by element, i.e. each value in the array (each of which is encoded with 64 bits as a float64, since the values are stored as a double).
I just confirmed on R2011a that the result of the code I posted is indeed true.
Noman Abir
le 5 Jan 2021
Which exact line doesn't return the expected value? You have not convinced me that there is anything wrong. Don't refer back to your code, put code in a comment instead. So far, the relevant parts of the code reduce down to the 3 lines in my comment, which don't show your problem.
To go back to your example, show code like this:
A=2;B=2;
C=A+B %should display 4, but does it?
if C==4,disp('Everything fine.'),else,disp('There is a severe issue with Matlab! Even plus() doesn''t work correctly!'),end
Before we can attempt to fix a problem we first need to make sure there is one and figure out what it is exactly.
Noman Abir
le 5 Jan 2021
Modifié(e) : Rik
le 5 Jan 2021
Rik
le 5 Jan 2021
Are you determined to not get help? You aren't proving anything with your current code. The only thing we know and agree on is that your code applied on your data doesn't return the audio you are expecting. You have not proven why your code should work, or even that your input data is correct.
To ensure your calculation just check every step values that what values should I get and what values i am getting from MATLAB.
No, that is what you need to do. At which step are you getting values that are different from your manual calculations? There are three options:
- Matlab has a bug in times that only you just uncovered (despite this being a core function since the first alpha Cleve Moler wrote and probably being tested extensively with regression tests on every new release)
- Your data (which is coming from an anonymous undocumented .mat file) is not the exact type and shape your code expects
- Your code (which is reasonably documented, but silent on what kind of data it expects and lacks any form of input validation) has incorrect assumptions
Which of these sounds more probable to you?
Unless and until you show me the line of code that diverges from your expectation, I do not expect there is any problem with Matlab.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!