Would you please solve this Matlab practice assignment, all I need are very simp
ID: 3571918 • Letter: W
Question
Would you please solve this Matlab practice assignment, all I need are very simple inputs for #33, #38 and #39. Thank you for your help, Chegg has been incredibly invalueable this semester.
33. (3 pts) create the vector zeta- (-4, 8, 2, -1, o, -5, 9, 3, 4) Then use the find function to return the following vector: I-4 5 9) 34. (10 pts) Prompt the user to enter a value for x and then prompt the user to enter a value for y. If the value of x is greater than the value of y, send a message to the command window telling the user that x.> y. If x is less than or equal to y, send a message to the command window telling the user that y x. 35 (10 pts) use a for loop to create a vector of the squares of the numbers 1 through 5. 36. (10 pts) Use a while loop to create a vector of the squares of the numbers l through 5. 37. (2 pts) create the following symbolic variables using the syms function. a 38. (2 pts) Using the variables from Problem 37, create the equation symbolically y 2ax b c. 39. (2 pts) Solve equation y for x.Explanation / Answer
Solution for Question:33
The following code will create a vector and find function to return required vector.
import java.util.*;
public class Csol1
{
public static void main(String[] args) {
Vector v=new Vector(),v6;
v.addElement(-4);v.addElement(8);v.addElement(2);v.addElement(-1);
v.addElement(0);v.addElement(-5);v.addElement(9);v.addElement(3);v.addElement(4);
System.out.println("v="+v);
System.out.println("Calling find function and displaying vector");
v6=find(v);
System.out.println(v6);
}
public static Vector find(Vector v1)
{
Vector v2=v1,v3=new Vector();
Enumeration e=v2.elements();
while (e.hasMoreElements())
{
int k=(int)e.nextElement();
switch (k)
{
case -4:v3.add(-4);break;
case 8:v3.add(8);break;
case -5:v3.add(-5);break;
case 9:v3.add(9);
}
}
return v3;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.