Simple MATLAB problem that has me stumped

  • Thread starter ja sam glup
  • Start date
  • Tags
    Matlab
In summary, the conversation discusses using an array to find values of y for the equation y = (e^3x) / (sqrt (x+1)) within the range of x = [1,10]. The attempt at a solution involved defining the function and using arrayfun(), but resulted in an error message. The solution involved using x = 1:10 and adding a dot to perform a value by value operation.
  • #1
ja sam glup
7
0

Homework Statement


Use an array for single digit values of x [1,10] to find values of y for the equation y = (e^3x) / (sqrt (x+1)).

Homework Equations


The Attempt at a Solution


So, I tried defining the function as Function [ (e^3x) / (sqrt (x+1))] = y(x) , but that gave me an error message. I then tried to just define x and y first with syms x; and syms y;, and then define y as y = (e^3x) / (sqrt (x+1)).

However, since this is actually not a function, i was not able to arrayfun() to get the answer that I needed. This is my first MATLAB homework and the TA didn't explain anything, he just said to do it.

Any help would be greatly appreciated.
 
Physics news on Phys.org
  • #2
Here this will fix your problem

Code:
x = 1:10;
y= (exp(3*x)) ./ (sqrt (x+1))

Take note of the dot (" . ") That tells MATLAB to perform a value by value operation rather than a matrix operation.
 

1. What is MATLAB and how is it used in scientific research?

MATLAB is a programming language and numerical computing environment commonly used in scientific research. It allows for efficient data analysis, visualization, and modeling through its built-in functions and toolboxes.

2. What is the best way to learn MATLAB for beginners?

The best way to learn MATLAB as a beginner is to start with the basics and gradually work your way up. This can include taking online tutorials or courses, practicing with small coding exercises, and exploring the various features and functions of the software.

3. How can I troubleshoot a simple MATLAB problem?

First, try to understand the problem by breaking it down into smaller parts and identifying which specific step is causing the issue. Then, check your code for any syntax errors or logical mistakes. It may also be helpful to consult online resources or ask for help from more experienced MATLAB users.

4. What are some common mistakes that beginners make when using MATLAB?

Some common mistakes that beginners make when using MATLAB include using incorrect syntax, not initializing variables properly, and not fully understanding the functions and toolboxes being used. It is important to carefully read through documentation and practice regularly to avoid these mistakes.

5. Can MATLAB be used for more complex scientific problems?

Yes, MATLAB is a powerful tool that can be used for complex scientific problems. It has advanced features and toolboxes for data analysis, image processing, and numerical simulations, making it a popular choice among scientists and researchers.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
875
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
941
  • Engineering and Comp Sci Homework Help
Replies
3
Views
805
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Precalculus Mathematics Homework Help
Replies
15
Views
627
  • Calculus and Beyond Homework Help
Replies
10
Views
980
  • Advanced Physics Homework Help
Replies
1
Views
683
Back
Top