

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
There are examples about matlab skills
Typology: Assignments
1 / 3
This page cannot be seen from the preview
Don't miss anything!


% 1. Skaler variables. Make the following variables: % a v = 7; % b x = 1.8 * 10^-13; % c y = 3 + 4j; % d z = exp(j2pi/5); % 2. Vector variables. Make the following variables: % a uVec = [2.7 5 17 23]; % b vVec = [3.14; 6; 24; 121]; % c xVec = [5:-0.2:-5]; % d yVec = logspace(0,1,100); % e zVec = "Hello"; % 3. Matrix variables. Make the following variables: % a. tMat = ones(9,9)3; % b. V = [1 2 3 4 5 4 3 2 1]; uMat = diag(V); % c. A = 1:100; vMat = reshape(A,[10,10]); % d. xMat = nan(3,4); % e. yMat = [7 8 9; 12 -5 93]; % f. zMat = -3 + 6.rand(5,3); zMat = ceil(zMat); % 4. Scalar equations. Using the variables created in 1, % calculate a , b , and c. % a. a = 1/(1+exp(-(v-13)/5)); % b.
b = (sqrt(v) + x^(1/12))^pi; % c. c = log(real((y+z)(y-z)sin(vpi/3)))/(yconj(y)); % 5. Vector equations % a. aVec = 1./(sqrt(2pi3.6^2).exp(-xVec.^2./(23.6^2))); % b. bVec = sqrt(uVec.'.^2 + uVec.^2); % c. cVec = log10(1./yVec); % 6. Matrix equations. aMat = (uVec * vVec) * tMat^ bMat = uVec * vVec; cMat = det(vMat) * (tMatuMat)'; % 7. Common functions and indexing % a. VMat = vMat.'; VSum = sum(VMat,2); vSum = VSum.'; % b. yMean = mean(yMat,2); % c. j = 1; yMat = [j j j; 12 -5 93]; % d. vSub = vMat([2:9],[2:9]); % e. lin=[1:20]; lin(2:2:end)=-lin(2:2:end) % f. r= rand(1,5); for ii=1: if r(ii) < 0. r(ii) = 0; end end %8. Plotting multiple lines and colors. figure t = linspace(0, 2pi, 1000); x = sin(t); y = cos(t); plot (t, sin(t), 'LineWidth', 2); hold on ; plot (t, cos(t), '--', 'LineWidth', 2); hold off; xlabel('Time'); ylabel('Function Values'); title('Sin and Cos Functions'); hLegend = legend ('Sin', 'Cos');