MATLAB (an abbreviation of "matrix laboratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages.
Although MATLAB is intended primarily for numeric computing, an optional toolbox uses the MuPAD symbolic engine allowing access to symbolic computing abilities. An additional package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic and embedded systems.
As of 2020, MATLAB has more than 4 million users worldwide. MATLAB users come from various backgrounds of engineering, science, and economics.
Hello I am trying to calculate the n-point DFT of a signal using fft where n=512 and plot it in matlab. The signal is a separate file that I have read into matlab. I am able read and plot the first 512 values of the signal but when I try to get the dft of the signal and plot it the outcome does...
Okay so what does this line of code mean:
snleg = strtrim(cellstr(num2str(alf_deg.')));
I did some research and it is ultimately removing whitespace (comma's, spaces etc) from a file scanned in, but I don't understand the argument of the function.
I don't understand what cellstr is or...
error in defined expression for Fresnel equation in MATLAB (urgent please )??
hi
i have code for plotting Fresnel equation but there's something i didn't understand it and gives
error >>(((
plotopt - plotting option (type 'R' for plotting reflectivity,
% 'A' for absorptivity or 'RA'...
I've been using this for a Newton Approximation in Matlab
function x = Newton(f, fp, x, nmax, e)
% f is an inline function which we apply Newton's method on
% fp is an inline function that is the derivative of function f
% x is the initial guess of the root
% nmax is the total number...
Here is the code I have, but I keep getting the error message: Undefined function 'f' for input arguments of type 'double'.
I don't know what I have that is causing this. Does anybody see what's wrong with my code?
MaxIt = 1000;
epsilon = 10^-5;
a=1;
b=2;
c = (b+a)/2;
NumIt = 0...
Hi all,
I'm looking to solve the following system of equations with boundary conditions using the shooting method in MATLAB:
F''=F^2-G^2+F'H
G''=2FG+G'H
H'=-2F
along with the conditions F(0)=0, G(0)=1, H(0)=0, F(infinity)=0, G(infinity)=0.
I've found the solution using the...
i have 2 simple MATLAB questions
first when i have two matrices
the first one is empty and the second one conatins numbers
i can
Say A=B
SO THE VALUE OF B BECOMES INSIDE A
BUT MY QUESTION I JUST DEFINE SYMS EI
and multiply it by B
bUT When itry to put Put B in A
IT DOENST WORK
COULD...
Hi all, (Don't mean to spam, meant to put this in General Math not General Engineering!)
I'm running the following code in MATLAB:
function M = nonNewtonian(~)
M = bvpinit(linspace(0,10,301),@VKinit);
sol = bvp4c(@VK,@VKbc,M);
figure;
hold all;
plot(sol.x,sol.y(2,:))...
How do I plot something like (x-4)(x-5)(x-6)?
I've tried:
x = -6:0.01:6;
y = (x-4)*(x-5)*(x-6);
plot(x,y)
It's giving me the error:
Error using *
Inner matrix dimensions must agree.
Hello everybody!
I'm quite new with Matlab and I'm starting trying some stuff..
well I was trying to input
det(a)
where a=[1,2,3;4,5,6;7,8,9] and this should be zero. And I mean 0.0000
but the result is
6.6613e-16
why?O.o
Hi everyone,
Lets say i have created a column vector c = [ N x 1 ] and my time vector has the same dimensions.
I want to create a function f(t) in which f(fstep) = c(cstep) where cstep is integer and fstep maybe not.
( for example f(0)=c(0), f(0.1)=c(1), ... f(10)=c(100))
As a result i...
Hi,
I am trying to plot the AN product sec II.C in the attached paper as:
clear all
clc
s=0.5;
w=0;
d=5;
f=0:20;
NdB1=(17-30.*log10(f));
N1=10.^(NdB1./10);
NdB2=40+20*(s-0.5)+26.*log10(f)-60.*log10(f+0.03);
N2=10.^(NdB2./10);
NdB3=50+7.5*w^0.5+20.*log10(f)-40.*log10(f+0.4)...
Hi,
I'm thinking about getting this laptop, it's small and cheap. I hope it's good enough for doing student-level calculations in Matlab, perhaps some simple programming, surfing, writing documents in Word etc.
Anyone tried Matlab on one of these?
I currently have a laptop but I'm so used to...
Given the following system of equations
3x1 + ax2 = 1
ax1 + 4x2 = 0
where -pi ≤ a ≤ pi. We would like to find out the range of values of x1 and x2 that are observed as a is varied. Do this as follows:
1. Create a for loop that uses the variable a as the indexing value, varied from over...
Is there one?
Or do I really have to write something like this:
from numpy import *
with open('file.txt','r') as f:
#read only data, ignore headers
lines = f.readlines()[31:]
# convert strings to floats and put into arrays
for i in xrange(len(lines)):
s =...
Homework Statement
I have an equation that looks like func=sin(pi*x*n)*sin(pi*y*m) I was wondering if there was any method (possibly involving for loops) where I could get a plottable function along xy for all the different combinations of n and m
i.e. m= 1 n =1
so the function would be...
I have to replace some matrix columns with some vectors. I am currently copying the original matrix and replacing the column of the matrix I have copied eg:
matrix_1 = matrix_2
matrix_2(:,4) = vector_1
This works fine, but I was wondering if it was possible to maybe amend the original matrix...
Homework Statement
Hey Everyone! So I have an assignment that says to approximate the integral f(x)=e^(3x), -1<x<3. Answer the following questions
Run the code with N=10, N=100, and N=1000.
For each approximation, when does the result agree with the exact value of the integral to 4 digits?
How...
Good day. Could anyone tell me how to simulate an equivalent Operational Amplifier in Simulink? I read somewhere that I had to do it with 2 adders and a gain block, but I don't know how. Thanks.
My objective is to create an applicator for the Matlab Newton-Raphsons method using only a function handle, the initial value and the number of iterations desired. I'm extremely new to Matlab and programming so bare with me for being programming deficient. My question is when making a loop, how...
THE PROBLEM :
y(t) = e^(-t)*sin(t^2);
with t0 = 0 and T = 3.14159. Find y_0, and use it to deduce the corresponding expression
for f(t, y) (Your f should have both a t and a y in it. Simplify it to find the y!).
This is for a MATLAB project. I've solved this differential equation (which we...
Homework Statement
I have a set of differential equations, which need to be solved by matlabs solvers. all of the states have to stay between 0 and 1, but they don't. I'm 100% sure my equations are right, but MATLAB is taking too big steps, causing the state to go negative or above 1.
most...
Homework Statement
I need to answer the attached question, but we haven't done anything similar in class and the book isn't proving to be helpful for me. I'm not sure if I have to use matlab, we were given this code but I can't even understand what it is calculating.
% f(x), the function...
The Problem: Write a function that finds the factorial of a positive integer without using for or while loops, the factorial function, or the : range operator.
Honestly, I don't really know how to start with this one. If I were able to use a for loop it would be easy, and I don't see how I...
Hello.
I am new in matlab. And I wonder how to solve equations using gauss-seidel iteration method.
Theoreticaly I understand how this method is working, but can't get how write script in matlab.
It can be great if somebody can give a explanation for this problem.
Hi everyone, my code is a little rusty and a work in progress but I was wondering how I would go about producing arrays for the calculations performed in the while loop for the analyses so they can be plotted.
I have the following parameter input;
G0 = 50;
v = 0.25...
Homework Statement
Consider the system defined by Y(s) = H(s)X(s) with H(s) = K \frac{s-a}{(s-b)(s-c)}. Build a function in MATLAB to simulate this system for given values of a,b,c,K and various input signals x(t) (in the time or in s-domain). Include a function to display plots of the time...
Hi guys,
I am studying aerospace engineering doing my final year. I am doing my final year project which is called "Development of Aircraft Wing Design Tool using MATLAB". It is basically to create a basic tool which will help a designer to design wings. I am totally confused on how to go...
I'm tasked currently with creating a MATLAB function to run Newton's method. From there I need to use this function to solve for the constants of a catenary which pass through (+-50, 100). I used wolfram alpha to find the proper constant as 107.432 so I would know if I was on the right track or...
First create the function file and name it whatever you would like. I prefer phase-portrait.
% Phase Plot Program
% To use this function, do the following:
% >> phase_portrait(x1, x2, y1, y2, tfinal, 'F', N); for example,
% >> phase_portrait(-5, 5, -5, 5, 10, 'F', 5)function [] =...
i don't know how i can use MATLAB to plot anti periodic fun ..
the origin site give this code for triangular fun:
fs = 10000;
t = -1:1/fs:1;
x1 = tripuls(t,20e-3);
plot(t,x1), xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Aperiodic Pulse')
but when i use this for sine...
Homework Statement
Does anyone know how to do this? Let's say I had the equation:
f(t) =
|2t, 0≤ t < 2
|(t^2)-3, 2≤t
how would you plot this over 0≤ t ≤4 in Matlab?
Homework Equations
-
The Attempt at a Solution
I've tried ezplot but i can't manage getting both...
Plotting Laplace Functions in Matlab - Help?
SORRY I MEANT LAPLACE FUNCTIONS
Homework Statement
so we have a function
f(t) =
|2t, 0≤ t < 2
|(t^2)-3, 2≤t
how would you plot this over 0≤ t ≤4 in Matlab?
Homework Equations
-
The Attempt at a Solution
I guess you could...
Sometimes I get the impression that employers want
a. Experience in a particular software tool AND
b. Specialization
and this trumps everything else other than work experience. It wasn't unsual for people with no formal educational background in Computer Science to land programming jobs...
A while back I tended a course in transform methods. During the course we were handed a MAtlab program that could be used to simulate convotution called Discrete Convolution Demo. It's kind of big or you might say bloated and I'd like some lightweight version or something. If someone know some...
I'm trying to figure out what these do in certain implementations. I can't seem to find the answer in the documentation.
http://www.mathworks.com/matlabcentral/fileexchange/30580-binary-amplitude-shift-keying[1]
for ii = 1:1:length(bit_stream)
ASK_signal = [ASK_signal...
I have inputed the following, I was given a signal and told to plot it in a time domain. The signal ECG is a data file and imported.
N = 15000;
fs = 250;
t = linspace(0, 60, N);
%signal = ecg data = ecg
subplot (2,1,1);
plot (t,ecg);
title ('Time-Domain ECG')
xlabel ('Time (s)')
ylabel...
I'm stuck on a really simple problem because I haven't done MATLAB in a while. I have transfer functions for nth order lowpass Butterworth Filters:
H(jw) = 1/(s + w_c)^n
I want to plot the 1st to 5th order filters. How do I input H(jw) into matlab? The tf(num, den) is not efficient in that...
Homework Statement
I need to plot an electric field in some range around base station, for example in range of 200m.
EIRP=57,5dBm
G=1 for the first example
N=4
Homework Equations
E=[2*sqrt(30*N*P*G)]/r
P=10exp[(EIRP-30)/10]
EIRP=57,5dBm
G=1 for the first example
N=4
The...
Dear Users,
the topic MATLAB num2str is closed, therefore I am posting this as a reply to that thread.
The suggestion by marcusl won't work for numbers of various format, but same number of valid digits. Example: The numbers
0.0056
0.0060
0.043
0.050
0.32
0.40
are valid to their...
Homework Statement
We're supposed to convolve the signal
x[k] = u[k] - u[k-8]
with its impulse response
h[k] = sin(pi*k/4)*( u[k] - u[k-8] )
with the help of MATLAB.
Homework Equations
-
The Attempt at a Solution
The thing is that we don't know how to do this in MATLAB...
Hi. Suppose I load data from a .csv file:
Blah
@Blah
2Blah
Blah
f Blah
fa Blah
Blahasd
Blahasda
vasf Blah
as Blah
asdas Blah
Date Time Ch1:
07/25/2012 42:46.0 96.385
07/25/2012 42:46.0 -177.608
07/25/2012 42:46.0 155.481
07/25/2012 42:46.0 64.15
an attempt would be to...
I need to create a MATLAB function file that will accept a modulo values (from 3 to 9; that is Z3 to Z9) and will output the least possible value describe by the modulo conditions
I don't know how to start it because I am not allowed to use the mod() and rem().
Please give me an idea how to do...
I have array of natural numbers from 1 to n.
They are divided into m groups, where m*(m-1)=n.
I need all m-1 elements from first group, last m-2 elements from second group, last m-3 elements from third group...zero elements from last group.
For example
5*4=20:
1,2,3,4; 5,6,7,8...
Hi Guys,
I don't know if I make sense but please try to help me.
I am working in Matlab. I have multiple line segments of different lengths with end point coordinates. I want to split each major segment into multiple minor segments in a way that all segments will have same length...
Homework Statement
Question: A ball is launched from a height of 12m. It should land in a pool that has a length of 22m and is 9m away from the wall. Find the minimum and maximum initial velocities for the ball to land in the pool. The ramp is angled at 1 radian such that vy = 0.54v and vx =...
Trying to make a three line loop that would differentiate x2√4x+1 to the nth term starting from the original function (n=0) to the 5th derivative (n=5) and then substitute 2 into the derivatives. Here's what I got
f = @(x) x2√4x+1
For n=[0:5] - As the nth term goes from 0 to 5...