How can I solve this problem?
2 views (last 30 days)
Show older comments
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 Comments
Rik
on 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.
Accepted Answer
KALYAN ACHARJYA
on 5 Jan 2021
Edited: KALYAN ACHARJYA
on 5 Jan 2021
Here, I provided the answer based on following
"I want to multiply "data1" with "c1" row to row and bit to bit values.
I am using this code for this : "result = bsxfun(@times, c1, data1);
As all the values are "1" in c1.
So, the result values should be as "data1"."
The code
demultiplex_data_y1=bsxfun(@times, c1, y_send);
Here c1
c1 =
1 1 1 1
And y_send
>> whos y_send
Name Size Bytes Class Attributes
y_send 1200000x4 38400000 double
bsxfun @times do the .*Array multiply with to two arrays with implicit expansion enabled. When you do the array operation with any element with "1" you suppose to get the same result, right. Hence in the following code, y_send and demultiplex_data_y1 must be same, because c1 having with all "1" elements
demultiplex_data_y1=bsxfun(@times, c1, y_send);
If you comapare the two array, you should be get the true "1" logic
>> isequal(demultiplex_data_y1,y_send)
ans =
logical
1
If I misunderstood this question, let me know, if I can help you it would be great for me
7 Comments
Rik
on 5 Jan 2021
Can you show an incorrect result? Can you point out values (i.e. specific locations) in demultiplex_data_y1 that are incorrect?
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!