Question

MATLAB 2017b Write a program which will: Accept three numbers from the user: a, b and...

MATLAB 2017b

Write a program which will:

Accept three numbers from the user: a, b and c which can assume any value.

Accept Dx and Dy for the calculations of the function

Write a function which accept a, b, c, Dx and Dy and will draw the following surface

Where x and y vary in the range of -10?x?10 -10?y?10.

Allow the user to rerun the program and exit the program upon request.

Homework Answers

Answer #1

Code

clc
clear all
while(1)
a=input("Enter Value of a=");
b=input("Enter Value of b=");
c=input("Enter Value of c=");
Dx=input("Enter Value of Dx=");
Dy=input("Enter Value of Dy=");

myfunction = @(x,y) (a*x.^2 + b*y.^2+c*x+Dx*Dy);
[X,Y] = meshgrid(-10:.5:10);

Z = myfunction(X,Y);
surf(X,Y,Z);
colorbar;
xlabel("X value");
ylabel("Y value");
zlabel("Function");

m=input('Do you want to rerun code, Y/N [Y]:','s');
if m=='N'
break
end

end

Output:-

Enter Value of a=0.5
Enter Value of b=22
Enter Value of c=0.75
Enter Value of Dx=1
Enter Value of Dy=25
Do you want to rerun code, Y/N [Y]:

Plot:-

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
10.16: Write a user-defined MATLAB function that solves a first-order ODE by applying the midpoint method...
10.16: Write a user-defined MATLAB function that solves a first-order ODE by applying the midpoint method (use the form of second-order Runge-Kutta method, Eqs(10.65),(10.66)). For function name and arguments use [x,y]=odeMIDPOINT(ODE,a,b,h,yINI). The input argument ODE is a name for the function that calculates dy/dx. It is a dummy name for the function that is imported into odeMIDPOINT. The arguments a and b define the domain of the solution, h is step size; yINI is initial value. The output arguments, x...
Write a python program that does the following: Prompts the user for three numbers in one...
Write a python program that does the following: Prompts the user for three numbers in one request. Be sure to specify the “delimiter” by which a user enters those three numbers. Divides the first number by the second number and add that result to the third number. Prints output that shows in one line the formula applied and the result of the calculation. Validate input by: •    Checking the user entered 3 values •    Appropriately checking for the following errors:...
Write a Python program which calculates the average of the numbers entered by the user through...
Write a Python program which calculates the average of the numbers entered by the user through the keyboard. Use an interactive loop and ask the user at each iteration if he/she wants to enter more numbers. At the end dispay the average on the screen. Using built-in library functions for finding average is not allowed. Sample output of the program: Enter a number > 23 More numbers (yes or no)? y Enter a number > 4 Do you have more...
Write a C++ program that: Allow the user to enter the size of the matrix such...
Write a C++ program that: Allow the user to enter the size of the matrix such as N. Call a function to do the following: Create a vector size n X n Populate the vector with n2distinct RANDOM integers.
Write a user-defined function, in MATLAB, with function call val=evalf(f,a,b) where f is an inline function,...
Write a user-defined function, in MATLAB, with function call val=evalf(f,a,b) where f is an inline function, and a and b are constants such that a<b. The function calculates the midpoint m of the interval [a,b] and returns the value of (1/2)f(a)+(1/3)f(m)+(1/4)f(b). Execute the function for f(x)=e^(-x)*cos(2x), a=-1, b=3.
C++ Write a program which accepts a numeric test score from the user. It will output...
C++ Write a program which accepts a numeric test score from the user. It will output the letter grade to the user corresponding to the score. Assume no “minus grades” (an A ranges from 90-100, B ranges from 80-89, C ranges from 70-79, D ranges from 60-69 and F is everything else.) Ensure that the score remains in the range of 0 to 100. As an example of the output: Enter your numeric grade and I will tell you your...
Use C++ Write a program that first reads in how many whole numbers the user wants...
Use C++ Write a program that first reads in how many whole numbers the user wants to sum, then reads in that many whole numbers, and finally outputs the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which will be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the numbers just once each and the user can enter them...
Write a C program, called logic_abc.c, that prompts the user to enter three integers a, b,...
Write a C program, called logic_abc.c, that prompts the user to enter three integers a, b, c, and then computes the results of the following logical operations, in sequence: !a || !b++ && c (a-1 || b/2) && (c*=2) (a-- || --b) && (c+=2) a || !(b && --c)
USING MATLAB Write a program called QuadProg that determines the roots of a quadratic equation. Use...
USING MATLAB Write a program called QuadProg that determines the roots of a quadratic equation. Use functions to implement each action. Zip you directory of *.m files into a single file and turn this in on BBLearn under Class Activities. QuadProg write a function called getInputs to get a single input value. write a function called findDiscriminant write a function called findDenominator write a function called findRoot which will be used for both roots write a function called displayResults displayResults...
In Matlab: Given the DrawRect function described in the lecture. function DrawRect(a, b, L, W, c)...
In Matlab: Given the DrawRect function described in the lecture. function DrawRect(a, b, L, W, c) x = [a a+L a+L a a]; y = [b b b+W b+W b]; fill(x, y, c); end Which of the following function call will draw a black square with size of 10 by 10 with the center at (5, 0)? a) DrawRect(0, -5, 10, 10, 'b') b) DrawRect(5, 0, 10, 10, 'b') c) DrawRect(0, -5, 10, 10, 'k') d) DrawRect(5, 0, 10, 10,...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT