I am writing a simple functin to solve for a frequency (OmegaD) and cannot figure out what the problem is, although it says it's an issue with syntax.
The name of the file: Parametros2doOrden.m
Here's the code:
Lamda = 0.3333
OmegaN= 3
OmegaD = OmegaN(sqrt(1-(lamda**2));
The error shown in the command window is the following:
>> Parametros2doOrden
parse error near line 3 of file /Users/guzmanleo17/Parametros2doOrden.m
syntax error
%tiempoP = pi/omegad;megad;mda**2)));
^

Antworten (1)

James Tursa
James Tursa am 31 Mär. 2020

0 Stimmen

lamda**2 is Fortran. I presume you want lamda^2 instead

5 Kommentare

Angel Guzman
Angel Guzman am 31 Mär. 2020
Thank you for the reply. Right, I tried both lamda**2 and lamda^2 but keep getting the same error as shown in my original post.
James Tursa
James Tursa am 31 Mär. 2020
Bearbeitet: James Tursa am 31 Mär. 2020
I just noticed this also
OmegaN(...
should be
OmegaN*...
Les Beckham
Les Beckham am 31 Mär. 2020
You are also missing a parenthesis on this line (in addition to the multiplication that James pointed out).
OmegaD = OmegaN(sqrt(1-(lamda**2));
James Tursa
James Tursa am 31 Mär. 2020
@Les: It's not that there is a missing ) at the end, it is that the first ( is erroneous and should be a * instead.
Les Beckham
Les Beckham am 31 Mär. 2020
Good point.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 31 Mär. 2020

Kommentiert:

am 31 Mär. 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by