1. Use polyfit to find a 4rd degree polynomial to fit the following set of data:
Value = -4:1:5; Vibration = [-507.6, -261.88, -100.03, -38.08, 6.9, 7.53, 15.6, 51.8, 182, 428.97].
Plot the best fitting curve and the data points on the same figure.
2. Given that a= [1 0 2] and b=[0 2 2] determine the values of the following expressions.
(a) a~=b
(b) a<b
(c) a<b<a
(d) a<b<b
(e) (a|~a)
(f) b&(~b)
(g) a(~(~b))
(h) a=b==a
(i) ~a<=b
(j) a>b&a<0
I have implemented the Task 1 and Task 2 per the given description.
Please find the following Code Screenshot, Output, and Code.
ANY CLARIFICATIONS REQUIRED LEAVE A COMMENT
Task 1:
1.CODE SCREENSHOT :
2.OUTPUT :
3.CODE :
%Given Data
Value = -4:1:5;
Vibration = [-507.6, -261.88, -100.03, -38.08, 6.9, 7.53, 15.6, 51.8, 182, 428.97];
%fit a fourth degree polynomial
fit=polyfit(Value,Vibration,4);
%plot the original and fitted data
plot(Value,Vibration,'O',Value,polyval(fit,Value));
xlabel('Value');
ylabel('Vibration');
Task 2:
Create the two vectors
(a) a~=b
a~=b return 0 if both are equal and 1 if both elements are not equal |
(b) a<b
a<b return true(1) when the value in 'a' is lessthan value in 'b' |
(c) a<b<a
(d) a<b<b
(e) (a|~a)
This is logical or with negation of itself which is always true |
(f) b&(~b)
This is logical and with negation of itself which is always false |
(g) a(~(~b))
(h) a=b==a
(i) ~a<=b
(j) a>b&a<0
Get Answers For Free
Most questions answered within 1 hours.