Question: how to convert this code into Matlab function i have this code but what to but in p & g in the function if i
how to convert this code into Matlab function
i have this code but what to but in p & g in the function if i have their values in the block ?
this is the code
and this is the simulink

and this is the matlab function
pen Advance Rur TI RUN OT Orj A Save Breakpoints Run Run and Print Find - Indent Advance FILE NAVIGATE EDIT BREAKPOINTS C: Users Alyazyah Downloads GP Editor - C:\Users\Alyazyah Downloads\GP Diffie_Hellman_Gethub.m Diffie_Hellman_Gethub.m X MATLAB Function + 1 clc; $clear command window 2 disp('Diffie Hellman Key Exchange'); 3 disp(' 4 clear 5 close all;$Clear variables in workspace and close figure 6 7 $Input value of g and p, and ensure that g and p Is prime 8 + 9 - 10 *** 11 - *** 12 13 14 prime = 0; while prime == 0 g = input ('Enter a value for g: '); p = input('Enter a Value for p: '); pg = isprime (g); pp = isprime (p); if pg == 0 disp('g is not prime'); end if pp == 0 disp('p is not prime'); end 15 16 17 - 18 19 - 20 Command Window fx Open Save Breakpoints Stop Buil Run Model 20 Print Find - Indent Model FILE NAVIGATE EDIT BREAKPOINTS RUN IRE C: Users Alyazyah Downloads GP Editor - Block: OFDM_with_TDI_DH/MATLAB Function Diffie_Hellman_Gethub.m X MATLAB Function function Keyl= prme (P,g) + Elprj A 1 07... 2 20... 3 = A... Keyi 0; Elwhile Keyl == 0 4 - 5 BE... Di... Ea... 6 7 1 E... 8 G... 9 pg = isprime (g); pp isprime (p); if pg == 0 = 10 - gr... Gr... Gr... 11 V 12 end S if pp == 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
