Question

Can I please get some help with this?? It's matlab. Code 1 1) Define a function as [NE]- nb_elemt24( n1,n2). 2) Define two vectors A and B by randi(10, [1,n1]) and randi(10, [1,

0 0
Add a comment Improve this question Transcribed image text
Answer #1
function [NE] = nb_elemt24(n1, n2)
    %% Part 2
    A = randi(10, [1, n1]);
    B = randi(10, [1, n2]);
    %% Part 3
    [C1, D1] = hist(A, unique(A));
    [C2, D2] = hist(B, unique(B));
    %% Part 4
    s1 = 0;
    s2 = 0;
    for i = 1:length(C1)
        if C1(i) >= 2
            s1 = s1 + 1;
        end
    end
    for i = 1:length(C2)
        if C2(i) >= 2
            s2 = s2 + 1;
        end
    end
    %% Part 5
    NE = [s1, s2];
    %% Part 7
    C1%
    D1%
    C2%
    D2%
    NE%
end

SAMPLE OUTPUT:

Command Window >>n220; NE nb elemt24 (nl, n2); D1 - 9 2 10 C2 D2 9 10 2 WP NE x >

Add a comment
Know the answer?
Add Answer to:
Can I please get some help with this?? It's matlab. Code 1 1) Define a function as [NE]- nb_elemt24( n1,n2). 2) Define two vectors A and B by randi(10, [1,n1]) and randi(10, [1,n2]), respectively...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can someone fix my coding please it's a calendar some days are placed wrong. I just...

    Can someone fix my coding please it's a calendar some days are placed wrong. I just want the Main menu to display first and second option and four option to end the program properly. Please remove option number 3 Find the number of days between 2 selected dates and the code that belongs to this function. #include<stdio.h> void days(int,int,int,int,int,int); int month(int,int); int mon[12]={31,28,31,30,31,30,31,31,30,31,30,31}; #define TRUE 1 #define FALSE 0 int days_in_month[]={0,31,28,31,30,31,30,31,31,30,31,30,31}; char *months[]= { " ", "\n\n\nJanuary", "\n\n\nFebruary", "\n\n\nMarch", "\n\n\nApril",...

  • Hello, I need to implement these small things in my C++ code. Thanks. 1- 10 characters...

    Hello, I need to implement these small things in my C++ code. Thanks. 1- 10 characters student first name, 10 characters middle name, 20 characters last name, 9 characters student ID, 3 characters age, in years (3 digits) 2- Open the input file. Check for successful open. If the open failed, display an error message and return with value 1. 3- Use a pointer array to manage all the created student variables.Assume that there will not be more than 99...

  • Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2...

    Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2*pi*1000*t); figure; plot(t,y1); xlabel('t (second)') ylabel('y(t)') axis([0,.004,-1.2,1.2]) % constrain axis so you can actually see the wave sound(y1,fs); % play sound using windows driver. %% % Check the frequency domain signal. fr is the frequency vector and f1 is the magnitude of F{y1}. fr=([0:no_pts-1]')/no_pts*fs; %in Hz fr=fr(1:no_pts/2); % single-sided spectrum f1=abs(fft(y1)); % compute fft f1=f1(1:no_pts/2)/fs; %% % F is the continuous time Fourier. (See derivation...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT