Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me for matlab code (computational methods in engineering) Write a MA

ID: 2319450 • Letter: P

Question

Please help me for matlab code (computational methods in engineering)

Write a MATLAB script that finds the unique values (non-repeated values) in a given array. Do not use unique(), find() or any other Matlab functions. "Matlab script" means "code in the editor page". Remember you type "edit" into command window and editor opens. Start your code with the below line. Your script must find the unique values in the array A. A = randi(100, 1, 100); Before starting your homework, I recommend you to study the tutorials, and do lots of examples. After that, you will be able to do homework more easily. How to submit your homework? Submit your homework into the lecture. Name your script(m-file) as "yournameSurnameHWl.m". For example, gokhandemirkiranHWl.m o Due date is: 31 October 2016.

Explanation / Answer

MATLAB code is:

clear all
close all
clc
A=sort(input('Enter Array : '));
len=length(A);
B(1)=A(1);
j=2;
for i=2:length(A)
if A(i)==B(j-1);
else
B(j)=A(i);
j=j+1;
end
end
  
  
B()'

sample output is

Enter Array : randi(100,1,100)

ans =

1
3
4
5
7
8
9
12
14
15
18
19
22
23
24
25
26
27
30
31
32
33
34
37
38
40
41
43
44
45
46
49
50
51
52
53
54
55
56
58
59
60
61
65
66
67
69
71
72
77
78
79
84
86
87
90
91
92
94
95
96
97

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote