Use matlab and write script:
Please use n = input('Enter the value of n :') not the function command.
Consider the following equation
6a + 9b + 20c = n
The variables a, b, and c can be thought of as the number (non-negative integers) of 6’s, 9’s, and 20’s in n. Note that for a given n, there might be one, multiple, or no solutions for a, b, and c. For example,
n = 15 → a = 1 and b = 1 and c = 0
n = 16 → no solution
n = 24 → a = 4 and b = 0 and c = 0: a = 1 and b = 2 and c = 0
Write a Matlab script that asks the user for n and calculates the solutions of this equation, i.e. how many 6’s, 9’s, and 20’s fit in n. Show that this equation has exact solutions for n = 50, 51, 52, 53, 54, and 55 and list all the combinations of a, b, and c for each case.
Deliverables: Your Matlab script and its outputs with the given values of n.
`Hey,
Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries
clc
clear all
close all
n=input('Enter n: ');
sol=0;
flag=0;
for a=0:(n/6)
for b=0:(n/9)
for c=0:(n/20)
if((n-(6*a)-(9*b))/c==20)
sol=[a;b;c];
flag=1;
break;
end
if((n-(20*c)-(9*b))/a==6)
sol=[a;b;c];
flag=1;
break;
end
if((n-(6*a)-(20*c))/b==9)
sol=[a;b;c];
flag=1;
break;
end
end
end
end
if(flag==1)
disp('Solution is');
disp(sol);
else
disp('Solution does not exist');
end

Kindly revert for any queries
Thanks.
Use matlab and write script: Please use n = input('Enter the value of n :') not...
4-6 on matlab
4. Write a program in a script file that determines the real roots of a quadratic equation ax2+bx+c 0 When the file runs, it asks the user to enter the values of the constants a, b, and c. To calculate the roots of the equation the program calculates the discriminant D, given by: D b2-4ac When D 0, the program displays message "The equation has two roots," and the roots are displayed in the next line. When...
Write a script that prompts the user to enter a value n (n > 6) that will generate an n element vector of random integers between 0 and 100 that will represent quiz grades. Then have the script calculate the average of the quizzes where the smallest grade is dropped. Then script will display the average of the quizzes along with the highest quiz grade. Given the following system of equations: 8s - 11t + 7u + 5v - w...
Write a MATLAB script, which asks the user to input the angle xd (in deg) and then approximates sine of the angle using the first 5 terms of Taylor series as follows: n+12n-1 sin n-1 (2n-1)! 1 Note that x in Taylor's equation is in radian, so make sure to do the conversion first Start with defining the vector n=1:5 and then use element-wise operation and basic MATLAB commands to calculate the summation. To calculate the factorial of any number,...
Write a script in MATLAB that prompts the user to do a, b, & c. a.)script that prompts the user to enter the day of the week using the input function. If the information the user enters is equal to “Saturday” or “Sunday”, display “have a nice weekend” in the Command Window. Otherwise, display “Good luck in your class lectures and your studies.” b.)script that prompts the user to input the following array by providing an example in the prompt:...
Using MATLAB code only please! 4. Write a script which does the following (use a while loop). a. Creates a random number b. Calculates the sum of random numbers selected, across all loop iterations c. Prints the number of random numbers (the number of loop iterations) which were required to add up to 20 (or more).
5.i) What will be the output of the script: for i-1:7 for j- 1:i fprintf(%d", j) end fprintf('\n') % start a new line. end 5 (i) For ax2 + bxc 0, the value of x is given by 2a Write a MATLAB function quadrasol () that will have three inputs ( a,b, and c) and two outputs corresponding to the solutions of the equation. It may be more compact if you defined another variable 'd' for the term inside the...
Please show in MATLAB code using if and else statements if necessary Write a program in a script file that converts a quantity of energy given in units of either J (Joules), Btu, or (ft-lb) to the equivalent quantity in different units specified by the user. The program asks the user to enter the quantity of energy, its current units, and the new desired units. The output is the quantity of power in the new units using the fprintf command....
Please use Matlab to solve and show your full codes
Write a script file Ask the user to enter sides of a triangle: a, b, c Check to see if the sides are all greater than 0 If they are: Use the function (triangle) that you created in your last homework problem (HW#5 problemttF) to calculate the area. command Display the results on the screen using fprintf write the results to disk using the fprintf command. If any of the...
P2) Write a MATLAB function myLinReg Username that is defined below. Use the in-built MATLAB function sum( ) to ease your programming (you are NOT allowed to use polyfit() and polyval()). Test the output of this function with the results obtained by hand for P1. Submit printout of program and a screenshot of the command window showing the results for P1. function [coeffvec, r2]-myLinReg_Username (xi,yi) %Function file: myLinReg-Username .m Purpose : 8 To obtain the parameters of a L.S. linear...
Matlab Question (Matlab Grader) Where indicated at the bottom of the script. write a function, called isright, that takes three inputs, a, b, and c, and determines whether they are could be the lengths of the sides of a right triangle; the output, y, will be set equal to the following: i). -1 if at least one of the values is not positive. Also, only for this case, have the function print out an error message, which states "At least...