Question

Write a code without using ceil or any other rounding commands (round, etc...) calculate ceil(x), where x is a positive number chosen by the user. USING MATLAB!

x = input('Enter a positive number: ');

Answer #1

What we can do is multiply the number by 10 store in a variable, keep adding 1 to it until mod(variable,10) becomes 0. Then print the variable/10.

Example :

Input = 11.8

temp = 11.8*10 = 118

mod(118,10) = 8

118+1 = 119

mod(119,10) = 9

119+1 = 120

mod(120,10) = 0 => So, print 120/10 = 12

CODE :

**clear all; close all; clc;**

**x = input('Enter a positive number: ');**

**temp = x*10;
r = mod(temp,10);
while i<10
if r==0
disp(temp/10);
break;
else
temp = temp+1;
r = mod(temp,10);
i=i+1;
end
end**

using matlab Write your own routine for Gaussian elimination
without any pivoting. Input for the routine should consist of the
number (n) of equations and the augmented matrix. Output should be
the vector solution of the system. Test your code by using it to
solve the following two problems: a) x + y + w + z = 10, 2x + 3y +
w + 5z = 31, −x + y − 5w + 3z = −2, 3x + y...

Write a java code that allows the user to input any name (up to
10 only) and then sorts and alphabetizes them in an array without
using predefined methods (.compareTo(), or any sorter functions)
and then print out the results.

4) Write a Java program using Conditions: Write a program where
it will ask user to enter a number and after that it will give you
answer how many digits that number has.
Steps: 1) Create Scanner object and prompt user to enter the
number and declare variable integer for input
2) Use if else condition with && condition where you
will specify the digits of numbers by writing yourself the digit
number that should display: Example(num<100 &&
num>=1), and...

Using MATLAB
Write a user-defined MATLAB function for the following math
function:
y(x)= (-0.2x^3 + 7x^2)e^-0.3x
The input to the function is x and the output is y. Write the
function such that x can be a vector (use element-by-element
operations).
(a) Use the function to calculate y(-1.5) and y(5).
(b) Use the function to make a plot of the function y(x) for -2
≤ x ≤ 6.

Python code only! (Do not include breaks or continue
functions)
Write a program that asks the user to enter the amount that they
budgeted for the month. A loop should then prompt the user to enter
their expenses, one at a time and to enter 0 to quit. When the loop
finishes, the program should display the the amount of budget left.
(a negative number indicates the user is over budget and a positive
number indicates the user is under...

Solve the following problem using the MATLAB environment
Write a function [approx_root, num_its] = bisection(f,a,b,tol)
that implements the bisection method. You function should take as
input 4 arguments with the last argument being optional, i.e, if
the user does not provide the accuracy tol use a default of 1.0e-6
(use varargin to attain this). Your function should output the
approximate root, approx_root and the number of iterations it took
to attain the root, num_its. However, if the user calls the...

Using python, write the program below.
Program Specifications:
You are to write the source code and design tool for the
following specification:
A student enters an assignment score (as a floating-point
value). The assignment score must be between 0 and 100. The program
will enforce the domain of an assignment score.
Once the score has been validated, the program will display the
score followed by the appropriate letter grade (assume a 10-point
grading scale). The score will be displayed as...

1) Write a java programming using a while
loop where you will add numbers and when you
press number 0 it will add all your
numbers and display the results.
Use Scanner object.
Steps:
1) Declare variables integer called sum which is equal to
zero
2) Declare Scanner object
3) Declare while condition where is true
4) Inside of that condition prompt the user to enter
the numbers
5) Declare variable integer called number and input
the number statement
6)...

Write a program display the following menu:
Ohms Law Calculator
1. Calculate Resistance in Ohms
2. Calculate Current in Amps
3. Calculate Voltage in volts
4. Quit Enter your choice (1-4)
If the user enters 1, the program should ask for voltage in
Volts and the current in Amps. Use the following formula:
R= E/i
Where:
E= voltage in volts
I= current in amps
R= resistance in ohms
If the user enters 2 the program should ask for the voltage...

Please do it in Python
Write the simplest program that will demonstrate iteration vs
recursion using the following guidelines -
Write two primary helper functions - one iterative
(IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of
which
Take the array and its size as input params and return a
bool.
Print out a message "Entering <function_name>" as the
first statement of each function.
Perform the code to test whether every element of the array is
a Prime number.
Print out...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 4 minutes ago

asked 12 minutes ago

asked 19 minutes ago

asked 23 minutes ago

asked 56 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 2 hours ago

asked 2 hours ago

asked 3 hours ago