Question

Need help with this simple MATLAB code. I'm trying to plot a new set of Y...

Need help with this simple MATLAB code. I'm trying to plot a new set of Y values from input X values. I get an error that says: "not enough input arguments."

clear all
clc
close all
Q = 3.44E+18;
D = 1.51E-17;
t = 7200;
x = [1E-6 2E-6 2.5E-6 3E-6 4.32E-6];
y = Q/sqrt((pi*D*t))*exp^(-(x)^2/(4*D*t))
plot(x,y, '*r')

xlabel('Depth'), ylabel('Concentration')

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CORRECTED MATLAB CODE

clear all
clc
close all
Q = 3.44E+18;
D = 1.51E-17;
t = 7200;
x = [1E-6 2E-6 2.5E-6 3E-6 4.32E-6];
y = Q/sqrt((pi*D*t))*exp(-(x).^2/(4*D*t))
plot(x,y, '*r')

xlabel('Depth'), ylabel('Concentration')

OUTPUT

4 2 2.5 3.5 Depth 4.5

EXPLANATION: You were doing mistake in this statement y = Q/sqrt((pi*D*t))*exp^(-(x)^2/(4*D*t)) , You were using a power sign in exp instead it should just be used without the power sign (^) . And another correction about the element by element multiplication by not using dot ( . ) operator, hence it should be used. The corrected statement y = Q/sqrt((pi*D*t))*exp(-(x).^2/(4*D*t))

Add a comment
Know the answer?
Add Answer to:
Need help with this simple MATLAB code. I'm trying to plot a new set of Y...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help in MATLAB. I'm working on a circuits lab report and I want to...

    I need help in MATLAB. I'm working on a circuits lab report and I want to plot the derivative of an input signal. The circuit is a differentiator OpAmp. It is receiving a triangle wave as an input and should output a square wave. (I've included my existing code.) The output formula is: Vout = -(Rf)*C*(dVin/dt) Where Rf is feedback resistance: Rf = 1*10^6; and C = 1*10^-6. EXISTING CODE: %% This section is copied, and then modified from another...

  • write a matlab code that can plot 3 excel files? this plot know can run one...

    write a matlab code that can plot 3 excel files? this plot know can run one excel file of 20crackf1. clc; clear all; close all; data1=xlsread('20f1','spectrum - PXI1Slot4_ai0','A8:B10009');% Importing excel file x=data1(:,1); y=data1(:,2); plot(x,y); xlim([0 100]); xlabel('Frequency in Hz'); ylabel('Amplitude in g'); title('FFT'); hold on; data2=xlsread('20crackf1','a1','A1:B5000'); x1=data2(:,1); y1=data2(:,2); plot(x1,y1); xlim([0 100]);

  • I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But...

    I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But I wanna get a plot of completely sinusoidal form. If I can magnify the plot and expand x-axis, maybe we can get the sinusoidal form. So help me with this problem by using matlab. Example is attached in below. One is the plot from this code and another is example. function second_order_ode2 t=[0:0.001:1]; initial_x=0; initial_dxdt=0; [t,x]=ode45(@rhs,t,[initial_x initial_dxdt]); plot(t,x(:,1)) xlabel('t') ylabel('x')...

  • I'm trying to solve this differential equations by using matlab. But I don't know the reason why I can't ge...

    I'm trying to solve this differential equations by using matlab. But I don't know the reason why I can't get the solutions. I've attached matlab code and few differential equation. Please find a the way to solve this problem. second oder ode2.m x+ function, second-oder-ode2 t-0:0.001:30 initial-x = 0; initial-dxdt = 0: lt.影=ode45( @rhs, t, [initial.x initial.dxdt ] ); plot(t.(:,1l): xlabel( t); ylabel(x): 申 function dxdt=rhs( t, x) dxdt-1 =x(2); dxdt-2 (-50 x(2)+61.25+((1-cos(4 pi 10 t))/2) (47380 x(1)-3-7428 x(1) 2...

  • I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But...

    I'm trying to solve this differential equations by using matlab and I've got a plot from the code attached. But I wanna get a plot of completely sinusoidal form. If I can magnify the plot and expand x-axis, maybe we can get the sinusoidal form. So help me with this problem by using matlab. Example is attached in below. One is the plot from this code and another is example. function second_order_ode2 t=[0:0.001:1]; initial_x=0; initial_dxdt=0; [t,x]=ode45(@rhs,t,[initial_x initial_dxdt]); plot(t,x(:,1)) xlabel('t') ylabel('x')...

  • Use Matlab to answer the following question 4. In this example, we will try to plot...

    Use Matlab to answer the following question 4. In this example, we will try to plot a dome similar to the US Capitol dome. If we assume x andy values range between -10 m and 10 m from the center of the dome, and radius R is 7 meter, we can use sphere formula to plot the dome: We will need to reformat this equation to return z as a function of x and y, so As you know, z-...

  • I'm trying to solve this problem by using matlab. But I don't know reason why I can't get the solutions. I w...

    I'm trying to solve this problem by using matlab. But I don't know reason why I can't get the solutions. I wanna get a plot of this differential equation. Please find a way how to solve this problem. May there're errors in the code. Please check it.    second-oder-ode2.m x 曱function, second-oder-ode2 t=0:0.001 :30; initial-× = 0; in i t i al-dxdt 0; lt,影=ode45( @rhs, t. [initial.x initial-dxdt ] ); plot( (:, 1) ) ; xlabel( 't); ylabel(): function dxdt=rhs( t,...

  • help me please , By using MATLAB How can I plot the solution of linear diffrential...

    help me please , By using MATLAB How can I plot the solution of linear diffrential system ? I want the code in general case We were unable to transcribe this imageclose all clear MATLAB Code: clc A= [1 0 1; 0 0 0;00-1]; % Coefficient Matrix Xo = [5 76]'; % Initial condition V, D = eig(A); % Get the Eigen values and Eigen vectors % General Solution: X=Sum of {c_i*exp(L_i*t) *V_i % where c_i are constants, L_i are...

  • please help me with this MATLAB CODE and explain to me what each line does and...

    please help me with this MATLAB CODE and explain to me what each line does and what is used for? leave your comments as words, not as pictures. ..................................................................................................................................................................... clear all; close all; % For a script file, you better start with clear all and close all                        % However, for a fucntion, you better NOT to start                        % with them %% End of cell mode example %% Plot function t = 0:0.1:5; x1 = sin(2*5*t); x2 = cos(3*7*t);...

  • Project in matlab. I have the correct ak value but not the correct ao value. My code is attached ...

    Project in matlab. I have the correct ak value but not the correct ao value. My code is attached below also 2. Determine and plot the magnitude and phase spectrum of the Fourier series coefficients a, that is, plot ja, I as a function of discrete frequencies Jok and La, as a function of discrete frequencies fok 03 025 蓋0.2 0.15 0.1 o o5 ·10-8-6 4610 phase -2 -2 8- t= 0: .01:4; 9- to = 4; 10- fo =1/4;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT