mat lab hw

profilebiper_9t4

in the attachment you can find the matlab hw with the patterns

 

%%
clear all
close all
clc

%% 2 Methods for reading data from the file
%% Method 1 - read until the 'End of File' is reached
f_id=fopen('prog2_pattern1.txt');%1) open file with filename

i=1;
while ~feof(f_id) 
    col1(i)=fscanf(f_id,'%f',1);
    col2(i)=fscanf(f_id,'%f',1);
    i=i+1;
end
fclose(f_id); %close file for other apps to use

%% Method 2 - read all at once then parse data into separate arrays
f_id=fopen('prog2_pattern1.txt');%1) open file with filename

all_data=fscanf(f_id,'%f');

for i=1:length(all_data)/2 %loop as many times as there are rows in file
    col3(i)=all_data(2*i-1);
    col4(i)=all_data(2*i);
end
fclose(f_id); %close file for other apps to use
  • 11 years ago
  • 20
Answer(2)

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    matlab_work.zip

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    pattern_1.txt
  • attachment
    pattern_2.txt
  • attachment
    pattern_3.txt